Tables("领导数据看板_Table1").Sort = "销量额 DESC"
Dim g As New GroupTableBuilder("统计表1", DataTables("userinfo"))
g.Groups.AddDef("period")
g.Totals.AddDef("pname", AggregateEnum.Count)
g.GrandProportion = True
g.FromServer = True
g.Build()
Dim cns() As String = {"入职", "初级", "中级", "优秀"}
Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Chart = e.Form.Controls("Chart2") ' 引用窗口中的图表
Chart.VisualEffect = True '加上这一行,让你的图表更漂亮
'Chart.HeaderText = "员工能力等级概览"
Chart.ChartType = ChartTypeEnum.Bar '图表1类型为Bar(条形)
Chart.SeriesList.Clear() '清除图表原来的图系
Series = Chart.SeriesList.Add() '增加一个图系
Series.Length = 4
For i As Integer = 0 To cns.length - 1 '指定每个数据点的位置
Dim dr As DataRow = DataTables("统计表1").find("period='" & cns(i) & "'")
If dr IsNot Nothing Then
Series.X(i) = i '指定水平坐标
Series.Y(i) = dr("pname") '垂直坐标用随机数生成
Chart.AxisX.SetValueLabel(i, cns(i)) '指定字符表示
End if
Next
Chart.AxisX.AnnoWithLabels = True
Series.DataLabelText = "{#YVAL}"
Dim Chart2 As WinForm.Chart '定义一个图表变量
Dim Series2 As WinForm.ChartSeries '定义一个图系变量
Chart2 = e.Form.Controls("Chart1") ' 引用窗口中的图表
Chart2.VisualEffect = True '加上这一行,让你的图表更漂亮
Chart2.AxisX.DateType = True '明确指定X轴是日期型
Chart2.AxisX.AnnoFormatString = "MM" '制定日期表示格式
Chart2.AxisY.Text = "销售额"
'Chart2.HeaderText = "2022年销售额走势图"
Chart2.ChartType = ChartTypeEnum.XYPlot '图表1类型为(线形)
Chart2.DataSource = "销量表" '设置绑定表
Chart2.SeriesList.Clear() '清除图表原来的图系
Series2 = Chart2.SeriesList.Add() '给图表1增加一个图系
Series2.Text = "年份"
Series2.X.DataField = "年份" 'X轴绑定到产品列
Series2.Y.DataField = "销量额" 'Y轴绑定到数量列
Series2.MarkShape = MarkShapeEnum.Dot
Series2.MarkSize = 3
Series2.DataLabelText = "{#YVAL}"