此主题相关图片如下:111.png
老师,对于上图,各个单位的颜色都一样,可以不一样么么?
''生成各单位人数临时表
Dim b As New GroupTableBuilder("统计表1",DataTables("person"))
Dim t As DataTable
b.Groups.AddDef("organName","单位")
b.Totals.AddDef("organName",AggregateEnum.Count,"人数")
'b1.FromServer = True
t=b.Build() '生成统计表
'Dim Chart As WinForm.Chart '定义一个图表变量
'Dim Series As WinForm.ChartSeries '定义一个图系变量
'Chart = e.Form.Controls("Chart1") ' 引用窗口中的图表
'Chart.ChartType = ChartTypeEnum.Bar '图表类型改为Bar(条形)
'Chart.DataSource = "统计表1" '设置绑定表
'Chart.SeriesList.Clear() '清除图表原来的图系
'For Each c As DataCol In t.DataCols
'If c.Name <> "单位" Then
'Series = Chart.SeriesList.Add() '增加一个图系
'Series.Text = c.Name '设置图系的标题
'Series.X.DataField = "单位" 'X轴绑定到产品列
'Series.Y.DataField = "人数" '设置Y轴的绑定列
'End If
'Next
'Chart.VisualEffect = True '加上这一行,让你的图表更漂亮
'Chart.LegendVisible = True '显示图列
'Chart.LegendCompass= CompassEnum.South '图列显示在南方(底端)
Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Chart = e.Form.Controls("Chart1") ' 引用窗口中的图表
Chart.ChartType = ChartTypeEnum.Bar '图表类型改为Bar(条形)
Chart.DataSource = "统计表1" '设置绑定表
Chart.AxisY.Min = 0 '指定Y轴的最小值
'Chart.AxisY.Max =10 '指定Y轴的最大值
Chart.AxisY.Major = 1 '主刻度间隔值为5000
Chart.SeriesList.Clear() '清除图表原来的图系
Series = Chart.SeriesList.Add() '增加一个图系
Series.X.DataField = "单位" 'X轴绑定到产品列
Series.Y.DataField = "人数" 'Y轴绑定到数量列
Series.DataLabelText = "{#YVAL}"
Chart.AxisX.AnnoRotation = - 45 'X轴标示逆时针旋转45度
Chart.BarClusterWidth = 20
Chart.VisualEffect = True '加上这一行,让你的图表更漂亮
Chart.LegendVisible = True '显示图列