Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Chart= Forms("生产图表").Controls("Chart1") ' 引用窗口中的图表
Chart.VisualEffect = True '加上这一行,让你的图表更漂亮
Chart.ChartType = ChartTypeEnum.XYPlot '图表1类型为Bar(条形)
'Chart.ChartType2 = ChartTypeEnum.XYPlot '图表2类型为线形
Chart.ChartType2 = ChartTypeEnum.Bar
Chart.DataSource = "统计表" '设置绑定表
Chart.HeaderText= "当月生产日报统计图表" '图表标题
Chart.Headerfont= New Font("宋体",12,FontStyle.Bold) '标题字体
Chart.SeriesList.Clear() '清除图表原来的图系
Series = Chart.SeriesList.Add() '给图表1增加一个图系
Series.Text = "加工费"
Series.X.DataField = "单位" 'X轴绑定到产品列
Series.Y.DataField = "加工费" 'Y轴绑定到数量列
Series.LineColor = Color.Red '指定颜色
Chart.SeriesList2.Clear() '清除图表原来的图系
Series = Chart.SeriesList2.Add() '给图表2增加一个图系
Series.Text = "人均加工费"
Series.X.DataField = "单位" 'X轴绑定到产品列
Series.Y.DataField = "人均加工费" 'Y轴绑定到数量列
Series.LineColor = Color.Green '指定颜色
Chart.LegendVisible = True '显示图列
Chart.LegendCompass= CompassEnum.South '图列显示在南方(底端)
Chart.AxisY.Text = "加工费"
Chart.AxisY2.Text = "人均加工费"
Chart.AxisY2.GridMajorVisible = False '隐藏Y2轴的网格线