Dim Chart As WinForm.Chart \'定义一个图表变量
Dim Series As WinForm.ChartSeries \'定义一个图系变量
Chart = Forms("趋势图").Controls("Chart1") \' 引用窗口中的图表
Chart.ChartType = ChartTypeEnum.XYPlot \'设置图表类型
Chart.AxisX.DateType = True \'明确指定X轴是日期型
Chart.AxisX.AnnoFormatString = "MM-dd" \'制定日期表示格式
Chart.SeriesList.Clear() \'清除图表原来的图系
Series = Chart.SeriesList.Add() \'增加一个图系
Dim drs As List(Of DataRow)
drs = DataTables("趋势图_table1").Select("日期 >= \'" & dt1 & "\' And 日期 <= \'" & dt2 & "\'")
Series.Length = drs.Count \'图系n个数据点
For i As Integer = 0 To drs.Count - 1 \'遍历所有行
Series.X(i) = drs(i)("日期") \'指定水平坐标
Series.Y(i) = drs(i)("价格") \'垂直坐标
Next
Series.LineColor = Color.Blue \'设置该图系的颜色
Series.MarkShape = MarkShapeEnum.Dot
Series.MarkColor = Color.Green
Series.Text = "市场"
Chart.AxisY.Text = "市场"
Series.TooltipText = "X = {#XVAL}, Y = {#YVAL}"
......