Dim lst4 As List(Of String) = dtt.GetValues("deptname2", "topdeptnamexx = '" & cus & "' and deptname2 Is not null ") '获得课名称集合
Chart = e.Form.Controls("Chart4") ' 引用窗口中的图表
Chart.VisualEffect = True '加上这一行,让你的图表更漂亮
Chart.ChartType = ChartTypeEnum.Bar '设置图表类型
Chart.SeriesList.Clear() '清除图表原来的图系
chart.AxisX.ClearValueLabel
chart.AxisY.ClearValueLabel
Series = Chart.SeriesList.Add() '增加一个图系
Dim d As Integer = 0
Series.Length = lst4.Count '图系的数据点数等于表的行数
Series.Text = "计划加班总数"
For k As Integer = 0 To lst4.Count - 1 '指定每个数据点的位置
Dim Averageovertime As Integer = 0
Dim dhi As Integer = 0
Series.X(k) = k '指定水平坐标
Dim drs As List(of DataRow)
drs = dtt.Select("[deptname2] = '" & lst4(k) & "'and [bd] = '" & dt3 & "'")
If drs.Count > 0 Then
For Each dttr As DataRow In drs
Averageovertime = dttr("otsum") * dttr("people") + Averageovertime '统计出公司总计划加班总数
Next
If Averageovertime > 0 Then
Series.Y(k) = CInt(Format(Averageovertime, "0"))
If Averageovertime > d Then
d = Averageovertime
End If
Else
Series.Y(k) = 0
End If
Else
Series.Y(k) = 0
End If
Chart.AxisX.SetValueLabel(k, lst4(k)) '指定字符表示
Next
Series.TooltipText = "{#YVAL}"
Series.DataLabelText = "{#YVAL}"
series.DataLabelForeColor = Color.blue
Series.DataLabelCompass =LabelCompassEnum.North
这里只有4个部,还能用这种转换方式来获取点击部门字符来统计人数信息。
后面到了课就有20几个了。。。