Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Dim t As Table = Tables("表A") '定义一个变量t引用数据表
Chart= e.Form.Controls("Chart1") ' 引用窗口中的图表
‘’Chart.VisualEffect = True
Chart.ChartType = ChartTypeEnum.XYPlot
Chart.SeriesList.Clear() '清除图表原来的图系
Series = Chart.SeriesList.Add() '增加一个图系
Series.Length = 25 '图系的数据点数等于表的行数
For i As Integer = 0 To 24 '指定每个数据点的位置
Series.X(i) = i '指定水平坐标
Series.Y(i) = 0
Next
For i As Integer = 0 To t.Rows.Count - 1 '指定每个数据点的位置
Dim d As Date = t.Rows(i)("时间")
Series.Y(d.Hour) = t.Rows(i)("数字") '指定垂直坐标
Next