Dim n1 As WinForm.ComboBox = e.Form.Controls("comnian1")
Dim g As New CrossTableBuilder("统计表3", DataTables("表A"))
g.HGroups.AddDef("类别")
g.VGroups.AddDef("日期", DateGroupEnum.Year, "{0}年")
g.Totals.AddDef("序号", AggregateEnum.Count, "数量")
g.FromServer = True
Dim d As Date = new Date(n1.value, 1, 1)
g.Filter = "日期 >= #" & d & "# And 日期 < #" & d.addyears(1) & "# "
g.Build()
'MainTable = Tables("统计表3")
Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Dim t As Table = Tables("统计表3") '定义一个变量t引用数据表
Chart= e.Form.Controls("Chart1") '引用窗口中的图表
Chart.ChartType = ChartTypeEnum.Bar '设置图表类型
Chart.SeriesList.Clear() '清除图表原来的图系
chart.AxisX.ClearValueLabel
Series = Chart.SeriesList.Add() '增加一个图系
Series.Length = t.Rows.Count '图系的数据点数等于表的行数
For i As Integer = 0 To t.Rows.Count - 1 '指定每个数据点的位置
Series.X(i) = i '指定水平坐标
Series.Y(i) = t.Rows(i)("序号_1") '指定垂直坐标
Chart.AxisX.SetValueLabel(i, t.Rows(i)("类别")) '指定字符表示
Next
Chart.AxisX.AnnoWithLabels = True '启用字符标示
Chart.VisualEffect = True '加上这一行,让你的图表更漂亮
Series.DataLabelText = "{#YVAL}" '固定标示