参考代码
Dim y1 As String = "2014"
Dim m1 As String = "3"
Dim y2 As String = "2015"
Dim m2 As String = "9"
Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Chart= e.Form.Controls("Chart1") ' 引用窗口中的图表
Chart.SeriesList.Clear() '清除图表原来的图系
Chart.AxisX.ClearValueLabel
Series = Chart.SeriesList.Add() '每年一个图系
Dim dt As DataTable = DataTables("统计表1")
Dim d1 As Date = new Date(y1,m1,1)
Dim d2 As Date = new Date(y2,m2,1)
series.Length = DateDiff("m",d1,d2)+1
For i As Integer = 0 To series.Length-1
Dim d As Date = d1.AddMonths(i)
Series.X(i) = i '指定水平坐标
Series.Y(i) = val(dt.Compute("sum(数量)", "年='" & d.year & "' and 月='" & d.month & "'"))
Chart.AxisX.SetValueLabel(i, Format(d, "yyyy年-MM月")) '指定字符表示
Next
Chart.AxisX.AnnoWithLabels = True '启用字符标示
Chart.AxisX.AnnoRotation = - 45