Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Dim tb1 As Table = Tables("标录分析_Table1") '定义一个变量t引用数据表
Dim chk As WinForm.CheckedComboBox = e.Form.Controls("CheckedComboBox1")
If chk.Text = "" Then
MessageBox.Show("请选择球号后执行!")
Else
Dim lst As new List(Of String)
lst.AddRange(chk.Text.Split(","))
Chart = e.Form.Controls("Chart1") ' 引用窗口中的图表
'Chart.ChartType = ChartTypeEnum.Bar
Chart.AxisX.ClearValueLabel '清除所有通过SetValueLabel设置的数值字符标示
Chart.SeriesList.Clear() '清除图表原来的图系
Dim gd As C1Chart.C1Chart = Chart.BaseControl '图表加滚动条
For Each c As String In lst
Series = Chart.SeriesList.Add() '增加一个图系
Series.Text = c '设置图系的标题
Series.Length = tb1.Rows.Count '设置图系的长度
Series.DataLabelText = "{#YVAL}%" '所有线条显示数据标示
For i As Integer = 0 To tb1.Rows.Count - 1
Series.X(i) = i
Series.Y(i) = Round2(tb1.Rows(i)(c)* 100,2)
Chart.AxisX.SetValueLabel(i,Format(tb1.Rows(i)("开标日期"),"yy-MM-dd") & vblf & Format(tb1.Rows(i)("本期概算"),"0.00"))
Next
Series.FitType = FitTypeEnum.Spline '采用平滑线条
Next
Chart.AxisX.AnnoWithLabels = True '启用字符标示
Chart.LegendVisible = True '显示图列
Chart.LegendCompass= CompassEnum.South '图列显示在南方(底端)
Chart.AxisX.AnnoRotation = - 45 'X轴标示逆时针旋转45度
Dim fnt As New Font("黑体",10)
Chart.AxisX.Font = fnt
gd.ChartArea.AxisX.ScrollBar.min = 0
gd.ChartArea.AxisX.ScrollBar.max = tb1.Rows.count
gd.ChartArea.AxisX.ScrollBar.Scale = 60 / tb1.Rows.count '比例,自己算 '图表加滚动条
End If
2、在在复选组合框Enter事件中写入:
e.Sender.ComboList = "中标比例|公司比例"