Dim t As Table = e. Form. Controls("Table月计划"). Table
Dim Chart As WinForm Chart 定义一个图表变量
Dim Series As WinForm. ChartSeries'定义一个图系变量
Chart=e.Form.Controls("Chart月计划")'引用窗口中的图表Chart. SeriesList. Clear() '清除图表原来的图系
Chart. AxisX. ClearValueLabel '清除图表原来的图系标识Chart.ChartType=ChartTypeEnum.Bar'设置图表类型
Chart.VisualEffect=True'加上这一行,让你的图表更漂亮
Series=Chart.SeriesList.Add()'增加一个图系
Series.Length=t.Rows.Count'设置图系的长度
For i As Integer=0 To t. Rows. Count-1’指定每个数据点的位置Series.X(i)=i’指定水平坐标
Series.Y(i)=t.Rows(i)("计划")'指定垂直坐标
Chart. AxisX. SetValueLabel(i, t. Rows(i)("月份")&“月”)’指定字符表示Series. FillColor = Color. blue
’设置条形图的填充颜色
’设置条形图的填充颜色
Series. DataLabelForeColor = Color. black
Series. DataLabelCompass
Series. DataLabelText =" {#YVAL}"
Series. DataLabelForeColor = Color. blue
Next
Series=Chart.SeriesList.Add()'增加一个图系
Series.Length=t.Rows.Count'设置图系的长度
For i As Integer=0 To t. Rows. Count-1'指定每个数据点的位置Series.X(i)=i’指定水平坐标
Series.Y(i)=t.Rows(i)("完成")'指定垂直坐标
Chart. AxisX. SetValueLabel(i, t. Rows(i)("月份")&"月")'指定字符表示Series. FillColor = Color. green
设置条形图的填充颜色
Series. DataLabelForeColor
’设置条形图的填充颜色
= Color. black
Series. DataLabelCompass = 0
Series. DataLabelText="{#YVAL}"
Series. DataLabelForeColor = Color. green
Next
Chart.AxisX.AnnoWithLabels=True'启用字符标示
,