Dim Chart As WinForm.Chart \'定义一个图表变量
Dim Series As WinForm.ChartSeries \'定义一个图系变量
Dim t1 As Table = Tables("销售预算进度分析") \'定义一个变量t引用数据表
Chart = e.Form.Controls("销售预算1") \' 引用窗口中的图表
Chart.ChartType = ChartTypeEnum.Bar \'图表类型改为Bar(条形)
Chart.ChartType2 = ChartTypeEnum.XYPlot \'图表2类型该为线形
Chart.SeriesList.Clear() \'清除图表原来的图系
Chart.SeriesList2.Clear() \'清除图表原来的图系
For Each c As Col In t.Cols
If c.Name <> "所属单位" And c.Name <> "年" And c.Name <> "月" And c.Name <> "预算完成比率" Then
Series = Chart.SeriesList.Add() \'增加一个图系
Series.Text = c.Name \'设置图系的标题
Series.Length = t1.Rows.Count \'设置图系的长度
For r1 As Integer = 0 To t1.Rows.Count -1
Series.X(r1) = r1
Series.Y(r1) = t1.Rows(r1)(c.Name)
Next
ElseIf c.Name <> "所属单位" And c.Name <> "年" And c.Name <> "月" And c.Name <> "销售实际" And c.Name <> "销售预算" Then
Series = Chart.SeriesList2.Add() \'增加一个图系
Series.Text = c.Name \'设置图系的标题
Series.Length = t1.Rows.Count \'设置图系的长度
For r1 As Integer = 0 To t1.Rows.Count -1
Series.X(r1) = r1
Series.Y2(r1) = t1.Rows(r1)(c.Name)
Next
End If
Next