有点蓝老师,我参照做了一个代码,如下:
Dim Chart As WinForm.Chart
Dim Series As WinForm.ChartSeries
Chart = e.Form.Controls("Chart2")
Chart.VisualEffect = True
Chart.ChartType = ChartTypeEnum.Bar
Chart.DataSource = "熔炼效率"
Chart.SeriesList.Clear()
Series = Chart.SeriesList.Add()
Series.Text = "一班熔速"
Series.X.DataField = "铸锭批号"
Series.Y.DataField = "熔炼1_熔速kgph"
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)("熔炼1_熔速kgph") '指定垂直坐标
Chart.AxisX.SetValueLabel(i, t.Rows(i)("铸锭批号")) '指定字符表示
Next
Chart.AxisX.AnnoWithLabels = True
但是显示:t是private ,因此在上下文中不可引用
错误代码:For i As Integer = 0 To t.Rows.Count - 1