Dim a = e.Form.Controls("TextBox1").Text
Dim b = e.Form.Controls("TextBox2").Text
Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Dim tbl As DataTable = DataTables("工时") '定义一个变量tbl引用数据表
Dim lst As List(Of String) = tbl.GetValues(a) '获得产品名称集合
Chart = e.Form.Controls("Chart1") ' 引用窗口中的图表
Chart.SeriesList.Clear() '清除图表原来的图系
Series = Chart.SeriesList.Add() '增加一个图系
Series.Length = lst.Count '设置图系的长度
For i As Integer = 0 To lst.Count - 1 '指定每个数据点的位置
Series.X(i) = i '指定水平坐标
Series.Y(i) = tbl.Compute("Sum(" & b & ")","[a] = '" & lst(i) & "'") '指定垂直坐标
Chart.AxisX.SetValueLabel(i, lst(i)) '指定字符表示
Next
Chart.AxisX.AnnoWithLabels = True '启用字符标示