Dim yy As WinForm.ComboBox = e.Form.Controls("Com年")
Dim de As String = Nothing
Dim fi As String = Nothing
Dim g As New CrossTableBuilder("月统计", DataTables("订单明细"))
g.HGroups.AddDef("年")
g.VGroups.AddDef("月")
g.Totals.AddDef("总价", "金额")
If yy.Text <> Nothing Then
de = yy.Text & " "
fi = "[年] = '" & yy.Text & "'" '2015年'"
End If
g.Filter = fi
g.Build()
Tables("统计1_ta统计表").DataSource = DataTables("月统计")
Tables("统计1_ta统计表").AutoSizeCols
Dim Chart As WinForm.Chart = e.Form.Controls("Chart1")
Dim Series As WinForm.ChartSeries '定义一个图系变量
Dim t As Table = Tables("月统计") '定义一个变量t引用数据表
'Chart = e.Form.Controls("Chart1") ' 引用窗口中的图表
Chart.ChartType = ChartTypeEnum.Bar '图表类型改为Bar(条形)
Chart.SeriesList.Clear() '清除图表原来的图系
Chart.SeriesList2.Clear()
Chart.AxisX.ClearValueLabel
Chart.AxisX.AnnoRotation = 0 'X轴标示逆时针旋转45度
For Each c As Col In t.Cols
If c.Name <> "年" Then
Series = Chart.SeriesList.Add() '增加一个图系
Series.Text = c.Caption '设置图系的标题
Series.Length = t.Rows.Count '设置图系的长度
For r As Integer = 0 To t.Rows.Count - 1
Series.X(r) = r
Series.Y(r) = t.Rows(r)(c.Name)
Chart.AxisX.SetValueLabel(r, t.Rows(r)("年")) '指定字符表示
Next
Series.DataLabelText = "{#YVAL}"
End If
Next
Chart.AxisX.AnnoWithLabels = True '启用字符标示
Chart.VisualEffect = True '加上这一行,让你的图表更漂亮
Chart.LegendVisible = True '显示图列
Chart.LegendCompass= CompassEnum.South '图列显示在南方(底端)
Chart.BarClusterWidth = 50
Dim fnt As New Font("黑体",22,FontStyle.bold)
If de = Nothing Then de = "月度"
Chart.HeaderText =de & "业绩分析报告"
Chart.HeaderFont = fnt