Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Dim t As Table = Tables("订单筛选_table1") '定义一个变量t引用数据表
Chart = e.Form.Controls("Chart1") ' 引用窗口中的图表
Chart.ChartType = ChartTypeEnum.Bar '图表类型该为Bar(条形)
Dim g As New GroupTableBuilder("统计表1", t.DataTable)
g.Groups.AddDef("日期", DateGroupEnum.Hour, "时")
g.Totals.AddDef("数量")
g.Build()
' MainTable = Tables("统计表1")
Chart.DataSource = "统计表1" '设置绑定表
Chart.SeriesList.Clear() '清除图表原来的图系
Series = Chart.SeriesList.Add() '增加一个图系
Series.X.DataField = "时" 'X轴绑定到产品列
Series.Y.DataField = "数量" 'Y轴绑定到数量列
Series.DataLabelText = "{#YVAL}"