文章目录
-
- 1.概述
- 2.入门
- 3.属性和方法
- 4.同志别走,加个QQ群啊
1.概述
- Bullet Graph 是条形图的一种变体
- 弹图具有单一的主要衡量标准(例如,当前年初至今的收入)
- Bullet Graph 在非常紧凑的空间中显示大量数据
- 可用于收入分析和费用分析
2.入门
BulletGraph bullet = new BulletGraph();
bullet.Dock = DockStyle.Fill;
bullet.FlowDirection = BulletGraphFlowDirection.Forward;
bullet.Orientation = Orientation.Horizontal;
bullet.FeaturedMeasure = 4.5;
bullet.ComparativeMeasure = 7;
bullet.LabelFontSize = 10;
bullet.LabelStroke = Color.Black;
bullet.MajorTickStroke = Color.Black;
bullet.Minimum = 0;
bullet.Maximum = 10;
bullet.Interval = 2;
bullet.MinorTicksPerInterval = 3;
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 });
this.Controls.Add(bullet);
3.属性和方法
属性 |
描述 |
代码添加 |
设计器添加 |
FlowDirection |
数值流动的方向(Forward:从小到大;Backward:从大到小) |
bullet.FlowDirection = BulletGraphFlowDirection.Forward; |
|
Orientation |
方向(横向或纵向) |
bullet.Orientation = Orientation.Horizontal; |
|
FeaturedMeasure |
特色测量(实际值) |
bullet.FeaturedMeasure = 4.5; |
|
FeaturedMeasureBarStroke |
特色测量的描边颜色(实际值的线条颜色) |
bullet.FeaturedMeasureBarStroke = Color.Red; |
|
ComparativeMeasure |
比较度量值(目标数值) |
bullet.ComparativeMeasure = 7; |
|
ComparativeMeasureSymbolStroke |
比较度量值颜色(目标数值颜色) |
bullet.ComparativeMeasureSymbolStroke = Color.Red; |
|
LabelFontSize |
标签字体大小(下方刻度大小) |
bullet.LabelFontSize = 10; |
|
LabelStroke |
标签描边(下方刻度颜色) |
bullet.LabelStroke = Color.Black; |
|
Minimum |
最小刻度 |
bullet.Minimum = 0; |
|
Maximum |
最大刻度 |
bullet.Maximum = 10; |
|
Interval |
刻度间隔 |
bullet.Interval = 2; |
|
MinorTicksPerInterval |
在主刻度之间显示的次刻度的计数 |
bullet.MinorTicksPerInterval = 2; |
|
MinorTickSize |
次刻度标识的长度 |
bullet.MinorTickSize = 10; |
|
MinorTickStroke |
次要刻度颜色(前提是上一个属性设置>0的值) |
bullet.MajorTickStroke = Color.Black; |
|
QuantitativeScaleLength |
定量量表的长度 |
bullet.QuantitativeScaleLength = 400; |
|
QualitativeRangesSize |
定量量表的高度 |
bullet.QualitativeRangesSize = 30; |
|
Caption |
描述 BulletGraph 唯一标题 |
bullet.Caption = “Test”; |
|
CaptionPosition |
标题位置(Near:近;Far:远)) |
bullet.CaptionPosition=BulletGraphCaptionPosition.Near |
|
BindRangeStrokeToTicks |
将刻度线颜色与RangeStroke颜色保持一致 |
bullet.BindRangeStrokeToTicks = true; |
|
BindRangeStrokeToLabels |
将刻度线标签颜色与RangeStroke颜色保持一致 |
bullet.BindRangeStrokeToLabels = true; |
|
MajorTickSize |
主刻度标识的长度 |
bullet.MajorTickSize = 15; |
|
MajorTickStroke |
主刻度颜色 |
bullet.MajorTickStroke = Color.Red; |
|
TickPosition |
刻度标识的位置(Below:下方;Above:上方;Cross:交叉) |
bullet.TickPosition = BulletGraphTicksPosition.Cross; |
|
LabelPosition |
设置刻度的标签位置(Below:下面;Above:上面) |
bullet.LabelPosition = BulletGraphLabelsPosition.Above; |
|
LabelFormat |
设置标签格式 |
bullet.LabelFormat = “#1 K”; |
|
LabelOffset |
偏移值(刻度和标签之间的距离) |
bullet.LabelOffset = 5; |
|
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 });
RangeStart
: 获取或设置范围起始值
RangeEnd
:获取或设置范围结束值
RangeStroke
:获取或设置范围笔划颜色
RangeOpacity
:获取或设置范围不透明度
RangeCaption
:获取或设置范围标题
4.同志别走,加个QQ群啊
文档参考:BulletGraph文档
文档参考:BulletGraph App