Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Dim t As Table = Tables("表A") '定义一个变量t引用数据表
Chart = e.Form.Controls("Chart1") ' 引用窗口中的图表
Chart.SeriesList.Clear() '清除图表原来的图系
Chart.AxisX.DateType = True
Chart.AxisX.AnnoFormatString = "yyyy-MM-dd"
Dim i As Integer = 0
For Each c As Col In t.Cols
If c.Name <> "日期" Then
Series = Chart.SeriesList.Add() '增加一个图系
Series.Text = c.Name '设置图系的标题
Series.Length = t.Rows.Count '设置图系的长度
Series.LineColor = Color.Red '线条颜色
Series.MarkShape = MarkShapeEnum.Dot '标识点形状-圆点
Series.MarkColor = Color.Green '标识点颜色-绿色
Chart.SeriesList(i).FitType = FitTypeEnum.Spline '波浪形
Series.DataLabelText = "{#YVAL} 元"
Series.DataLabelCompass = LabelCompassEnum.NorthEast
For r As Integer = 0 To t.Rows.Count - 1
Series.X(r) = t.Rows(r)("日期")
Series.Y(r) = t.Rows(r)(c.Name)
Series.TooltipText = "产品: " & c.Name & vbcrlf & "日期: {#XVAL:yyyy-MM-dd}" & vbcrlf & "金额: {#YVAL} 元"
Next
i = i + 1
End If
Next
Chart.LegendVisible = True '显示图列
Chart.LegendCompass= CompassEnum.South '图列显示在南方(底端)
Dim a As C1Chart.C1Chart = Chart.BaseControl
a.ChartArea.AxisX.ScrollBar.Scale = 0.2
a.ChartArea.AxisX.ScrollBar.Visible = True
[此贴子已经被作者于2018/2/24 9:13:20编辑过]