生成图表的代码改为:
Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Chart= e.Form.Controls("Chart1") ' 引用窗口中的图表
Chart.SeriesList.Clear() '清除图表原来的图系
Dim r As Row =Tables("沥青混合料试验结果").Current
If r Is Nothing Then
Return
End If
Dim nms() As String = {"37.5mm","31.5mm","26.5mm","19mm","16mm","13.2mm","9.5mm","4.75mm","2.36mm","1.18mm","0.6mm","0.3mm","0.15mm","0.075mm"}
Series = Chart.SeriesList.Add() '增加一个图系
Series.Length = 14 '新增图系包括14个数据点
For i As Integer = 0 To 13 '指定每个数据点的位置
Series.X(i) = i '指定水平坐标
Series.Y(i) = Tables("沥青混合料试验结果").Current("筛孔" & (i+1))
'Chart.AxisX.SetValueLabel(i, nms(i)) '指定字符表示
Next
'Chart.AxisX.AnnoWithLabels = True '启用字符标示
这样就筛选就不会出错了。
至于横坐标和纵坐标,你看看帮助中生成图表这一章,再看看上面的代码,想学习,再尝试,不要完全靠别人,这是最好的学习方式。
最后搞不定,再提问不迟。