请教老师,下面代码生成的图表,年度与目标产值和总奖金的值不匹配,要采用非绑定吗?
Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Chart = e.Form.Controls("Chart1") ' 引用窗口中的图表
Chart.VisualEffect = True '加上这一行,让你的图表更漂亮
Chart.ChartType = ChartTypeEnum.Bar '图表1类型该为Bar(条形)
Chart.ChartType2 = ChartTypeEnum.XYPlot '图表2类型该为线形
Chart.DataSource = "表D" '设置绑定表
Chart.AxisX.DateType = True 'X轴是日期型
Chart.AxisX.AnnoFormatString = "yyyy"
Chart.SeriesList.Clear() '清除图表原来的图系
Series = Chart.SeriesList.Add() '给图表1增加一个图系
Series.Text = "目标产值"
Series.X.DataField = "年度" 'X轴绑定到产品列
Series.Y.DataField = "目标产值" 'Y轴绑定到数量列
Chart.SeriesList2.Clear() '清除图表原来的图系
Series = Chart.SeriesList2.Add() '给图表2增加一个图系
Series.Text = "总奖金"
Series.X.DataField = "年度" 'X轴绑定到产品列
Series.Y.DataField = "总奖金" 'Y轴绑定到数量列
Chart.LegendVisible = True '显示图列
Chart.LegendCompass= CompassEnum.South '图列显示在南方(底端)
Chart.AxisY.Text = "目标产值"
Chart.AxisY2.Text = "总奖金"
此主题相关图片如下:123.jpg