Dim dict As new Dictionary(of String,Integer)
dict.Add("A",1)
dict.Add("B",2)
dict.Add("C",3)
dict.Add("D",4)
Dim yue() As String = {"一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"}
Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Dim dr As DataRow = DataTables("基层人员年度绩效汇总审批表").Find("工号='" & e.Form.Controls("TextBox1").Text & "'")
If dr IsNot Nothing Then
Chart= e.Form.Controls("Chart1") ' 引用窗口中的图表
Chart.SeriesList.Clear() '清除图表原来的图系
Series = Chart.SeriesList.Add() '增加一个图系
Series.Length = 12 '图系的数据点数等于表的行数
Chart.AxisY.Max = 4
Chart.AxisY.MinorTick = False
Chart.AxisY.AnnoWithLabels = True
For i As Integer = 0 To 11 '指定每个数据点的位置
Series.X(i) = i+1 '指定水平坐标
If dr.IsNull(yue(i)) = False Then Series.Y(i) = dict(dr(yue(i))) '指定垂直坐标
Next
Dim j As Integer = 1
For Each key As String In dict.Keys
Chart.AxisY.SetValueLabel(j, key)
j += 1
Next
Dim dr2 As DataRow = DataTables("部门均值统计表").Find("二级部门='" & dr("二级部门")& "'")
If dr2 IsNot Nothing Then
Chart= e.Form.Controls("Chart2") ' 引用窗口中的图表
Chart.SeriesList.Clear() '清除图表原来的图系
Series = Chart.SeriesList.Add() '增加一个图系
Series.Length = 12 '图系的数据点数等于表的行数
Chart.AxisY.Max = 4
Chart.AxisY.MinorTick = False
Chart.AxisY.AnnoWithLabels = True
For i As Integer = 0 To 11 '指定每个数据点的位置
Series.X(i) = i+1 '指定水平坐标
If dr.IsNull(yue(i)) = False Then Series.Y(i) = dict(dr(yue(i))) '指定垂直坐标
Next
j=1
For Each key As String In dict.Keys
Chart.AxisY.SetValueLabel(j, key)
j += 1
Next
Chart.SeriesList2.Clear()
Dim Series2 As WinForm.ChartSeries = Chart.SeriesList2.Add() '增加一个图系
Series2.Length = 12
For i As Integer = 0 To 11 '指定每个数据点的位置
Series2.X(i) = i+1 '指定水平坐标
Series2.Y(i) = dr2(yue(i) & "_均值") '指定垂直坐标
Next
End If
End If