图表显示的列名不对,请问是哪里出问题了?
生成的统计表如下:
生成的图表如下:
Dim g1 As New CrossTableBuilder("异常费用统计表1", DataTables("异常费用"))
g1.HGroups.AddDef("周")
g1.VGroups.AddDef("责任部门")
g1.Totals.AddDef("异常费用", "异常费用")
g1.HorizontalTotal = True
g1.Build()
Tables("异常费用统计表1").Sort = "合计 DESC"
Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Chart = e.Form.Controls("图表1") ' 引用窗口中的图表
Chart.VisualEffect = True '加上这一行,让你的图表更漂亮
Chart.ChartType = ChartTypeEnum.Bar '图表类型该为Bar(条形)
Chart.DataSource = "异常费用统计表1" '设置绑定表
Chart.SeriesList.Clear() '清除图表原来的图系
Dim n As Integer = Tables("异常费用统计表1").Cols.Count
Dim i As Integer
For i = 1 To n - 2
Dim j As String = Tables("异常费用统计表1").Cols(i).Name
Series = Chart.SeriesList.Add() '增加一个图系
Series.Text = j
Series.X.DataField = "周" 'X轴绑定到产品列
Series.Y.DataField = j 'Y轴绑定到数量列
Next
Chart.LegendVisible = True '显示图列
Chart.LegendCompass = CompassEnum.South '图列显示在南方(底端)
Chart.Stacked = True '将图表堆叠起来