柱状图_AfterLoad
'
'设定图表数据,因为只是演示,所以数据只用人工设置
'
Dim a() As Integer =
{100,90,80,85,70,80,101,105,75,66,88,110}
Dim i均值 As Integer
= 87.5
Dim i上限 As Integer
= 100
Dim i下限 As Integer
= 80
'
'生成图表
'
Dim i As Integer
Dim Chart As
WinForm.Chart = e.Form.Controls("Chart1")
Dim C1Cha As
C1.Win.C1Chart.C1Chart = Chart.BaseControl
Dim Series As
WinForm.ChartSeries
Chart.VisualEffect
= True
Chart.ChartType =
ChartTypeEnum.Bar
Chart.SeriesList.Clear()
Series =
Chart.SeriesList.Add()
Series.Length = 12
Series.Text =
"金额"
For i = 0 To 11
Series.X(i) = i
Series.Y(i) = a(i)
Chart.AxisX.SetValueLabel(i, i+1 &
"月")
Next
Chart.AxisX.AnnoWithLabels
= True
Chart.LegendVisible
= True
Chart.LegendCompass=
CompassEnum.South
'
'增加均值
'
Dim tl As
C1.Win.C1Chart.TrendLine =
C1Cha.ChartGroups(0).ChartData.TrendsList.AddNewTrendLine()
tl.LineStyle.Color
= Color.Gold '线条颜色
tl.LineStyle.Thickness
= 2 '线宽
tl.LineStyle.Pattern
= 0 '直线样式 0-5
Dim zxb = New zxb柱状图标辅助线()
zxb.SetXY(New
PointF(-0.5,87.5),New PointF(11.5,87.5))
zxb.SetText("均线")
tl.CustomTrendLine
= zxb
'
'增加下限
'
tl =
C1Cha.ChartGroups(0).ChartData.TrendsList.AddNewTrendLine()
tl.LineStyle.Color
= Color.red
tl.LineStyle.Thickness
= 2
tl.LineStyle.Pattern
= 2
zxb = New zxb柱状图标辅助线()
zxb.SetXY(New
PointF(-0.5,80),New PointF(11.5,80))
zxb.SetText("下限")
tl.CustomTrendLine
= zxb
'
'增加上限
'
tl =
C1Cha.ChartGroups(0).ChartData.TrendsList.AddNewTrendLine()
tl.LineStyle.Color
= Color.BurlyWood
tl.LineStyle.Thickness
= 2
tl.LineStyle.Pattern
= 2
zxb = New zxb柱状图标辅助线()
zxb.SetXY(New
PointF(-0.5,i上限),New PointF(11.5,i上限))
zxb.SetText("上限")
tl.CustomTrendLine
= zxb