Loading...
Loading...
Implementation guide for Syncfusion Windows Forms Bullet Graph control for compact data visualization. Use this when working with bullet graphs, performance indicators, KPI visualization, comparative measures, or qualitative ranges in WinForms. This skill covers dashboard gauges, target vs actual comparisons, and performance range visualization in Windows Forms desktop applications.
npx skill4agent add syncfusion/winforms-ui-components-skills syncfusion-winforms-bullet-graphusing System;
using System.Drawing;
using System.Windows.Forms;
using Syncfusion.Windows.Forms.BulletGraph;
namespace BulletGraphDemo
{
public class MainForm : Form
{
public MainForm()
{
// Create Bullet Graph
BulletGraph bullet = new BulletGraph();
bullet.Dock = DockStyle.Fill;
// Set orientation and flow
bullet.FlowDirection = BulletGraphFlowDirection.Forward;
bullet.Orientation = Orientation.Horizontal;
// Configure measures
bullet.FeaturedMeasure = 4.5; // Actual value
bullet.ComparativeMeasure = 7; // Target value
// Configure scale
bullet.Minimum = 0;
bullet.Maximum = 10;
bullet.Interval = 2;
bullet.MinorTicksPerInterval = 3;
// Add qualitative ranges
bullet.QualitativeRanges.Add(new QualitativeRange()
{
RangeEnd = 4,
RangeCaption = "Bad",
RangeStroke = Color.Red
});
bullet.QualitativeRanges.Add(new QualitativeRange()
{
RangeEnd = 7,
RangeCaption = "Satisfactory",
RangeStroke = Color.Yellow
});
bullet.QualitativeRanges.Add(new QualitativeRange()
{
RangeEnd = 10,
RangeCaption = "Good",
RangeStroke = Color.Green
});
// Add caption
bullet.Caption = "Revenue YTD\n$ in thousands";
// Add to form
this.Controls.Add(bullet);
}
}
}BulletGraph revenueGraph = new BulletGraph();
revenueGraph.Dock = DockStyle.Top;
revenueGraph.Height = 100;
revenueGraph.Caption = "Revenue YTD\n$ in thousands";
revenueGraph.CaptionPosition = BulletGraphCaptionPosition.Near;
// Set actual vs target
revenueGraph.FeaturedMeasure = 275; // Actual: $275k
revenueGraph.ComparativeMeasure = 300; // Target: $300k
// Configure scale
revenueGraph.Minimum = 0;
revenueGraph.Maximum = 400;
revenueGraph.Interval = 100;
revenueGraph.LabelFormat = "$#0K";
// Performance ranges
revenueGraph.QualitativeRanges.Add(new QualitativeRange()
{ RangeEnd = 200, RangeStroke = Color.FromArgb(255, 200, 200) }); // Poor
revenueGraph.QualitativeRanges.Add(new QualitativeRange()
{ RangeEnd = 300, RangeStroke = Color.FromArgb(255, 255, 200) }); // Fair
revenueGraph.QualitativeRanges.Add(new QualitativeRange()
{ RangeEnd = 400, RangeStroke = Color.FromArgb(200, 255, 200) }); // GoodBulletGraph kpiGraph = new BulletGraph();
kpiGraph.Orientation = Orientation.Vertical;
kpiGraph.FlowDirection = BulletGraphFlowDirection.Backward;
kpiGraph.Dock = DockStyle.Left;
kpiGraph.Width = 150;
kpiGraph.Caption = "Customer\nSatisfaction";
kpiGraph.CaptionPosition = BulletGraphCaptionPosition.Far;
kpiGraph.FeaturedMeasure = 8.5; // Current score
kpiGraph.ComparativeMeasure = 9; // Target score
kpiGraph.Minimum = 0;
kpiGraph.Maximum = 10;
kpiGraph.Interval = 2;BulletGraph styledGraph = new BulletGraph();
// Customize featured measure bar
styledGraph.FeaturedMeasure = 65;
styledGraph.FeaturedMeasureBarStroke = Color.DarkBlue;
styledGraph.FeaturedMeasureBarStrokeThickness = 8;
// Customize comparative measure
styledGraph.ComparativeMeasure = 80;
styledGraph.ComparativeMeasureSymbolStroke = Color.Red;
styledGraph.ComparativeMeasureSymbolStrokeThickness = 3;
// Customize ticks and labels
styledGraph.MajorTickStroke = Color.Black;
styledGraph.MajorTickSize = 15;
styledGraph.MinorTickStroke = Color.Gray;
styledGraph.MinorTickSize = 10;
styledGraph.LabelFontSize = 12;
styledGraph.LabelStroke = Color.Black;// Stack multiple bullet graphs vertically
BulletGraph[] metrics = new BulletGraph[3];
string[] captions = { "Sales\n$ in thousands", "Profit\n$ in thousands", "Customers\ncount" };
double[] actuals = { 275, 45, 1250 };
double[] targets = { 300, 50, 1500 };
for (int i = 0; i < 3; i++)
{
metrics[i] = new BulletGraph();
metrics[i].Dock = DockStyle.Top;
metrics[i].Height = 80;
metrics[i].Caption = captions[i];
metrics[i].FeaturedMeasure = actuals[i];
metrics[i].ComparativeMeasure = targets[i];
// Add standard ranges
metrics[i].QualitativeRanges.Add(new QualitativeRange()
{ RangeEnd = targets[i] * 0.6, RangeStroke = Color.LightCoral });
metrics[i].QualitativeRanges.Add(new QualitativeRange()
{ RangeEnd = targets[i] * 0.9, RangeStroke = Color.LightYellow });
metrics[i].QualitativeRanges.Add(new QualitativeRange()
{ RangeEnd = targets[i] * 1.2, RangeStroke = Color.LightGreen });
this.Controls.Add(metrics[i]);
}| Property | Type | Description |
|---|---|---|
| double | Primary value to display (current/actual) |
| Color | Color of the featured measure bar |
| int | Thickness of the featured measure bar |
| double | Target or benchmark value |
| Color | Color of the comparative measure line |
| int | Thickness of the comparative measure line |
| Property | Type | Description |
|---|---|---|
| double | Starting value of the scale |
| double | Ending value of the scale |
| double | Spacing between major ticks |
| int | Number of minor ticks between major ticks |
| Property | Type | Description |
|---|---|---|
| Orientation | Horizontal or Vertical display |
| BulletGraphFlowDirection | Forward or Backward flow |
| string | Label describing the metric |
| BulletGraphCaptionPosition | Near or Far caption placement |
| Property | Type | Description |
|---|---|---|
| QualitativeRangeCollection | Collection of qualitative range objects |
| int | Width/height of the range bands |