'------------------------------------------
'---------------------------查询开始-------------------------------------
Dim Filter As String
With e.Form.Controls("TextBox1")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "单位名称 = '" & .Value & "'"
End If
End With
With e.Form.Controls("StartDate")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "日期 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("EndDate")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "日期 <= #" & .Value & "#"
End If
End With
'---------------------------查询结束-------------------------------------
'------------------------------------------
Dim b As New GroupTableBuilder("统计表1",DataTables("产品"))
b.Groups.AddDef("月")
'b.Groups.AddDef("单位名称")
b.Totals.AddDef("数量")
b.filter = Filter
Tables("图表_Table1").DataSource = b.BuildDataSource()
Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Chart = e.Form.Controls("Chart1") ' 引用窗口中的图表
Chart.VisualEffect = True '加上这一行,让你的图表更漂亮
Chart.ChartType = ChartTypeEnum.Bar '图表类型该为Bar(条形)
Chart.DataSource = "图表_Table1" '设置绑定表
Chart.SeriesList.Clear() '清除图表原来的图系
Series = Chart.SeriesList.Add() '增加第一个图系
Series.Text = "数量"
Series.X.DataField = "月" 'X轴绑定到产品列
Series.Y.DataField = "数量" 'Y轴绑定到数量列
Chart.AxisX.Major = 1
Chart.AxisX.MinorTick = False
Chart.LegendVisible = True '显示图列
Chart.LegendCompass= CompassEnum.South '图列显示在南方(底端)