Dim MyData(2, 2) As Double
'-----x轴坐标值-----Y轴坐标值----------
MyData(0, 0) = 1000: MyData(0, 1) = 1500: MyData(0, 2) = 10
MyData(1, 0) = 1500: MyData(1, 1) = 1602: MyData(1, 2) = 12
MyData(2, 0) = 1200: MyData(2, 1) = 1785: MyData(2, 2) = 20
'MyData(12, 2) = 112: MyData(12, 0) = 60
'MyData(12, 1) = 500
'波形图外观设置
With MSChart1
.TitleText = "图 型"
' '设置图线的外观
.Plot.SeriesCollection(1).Pen.Width = 30
.Plot.SeriesCollection(1).Pen.Style = VtPenStyleSolid
.Plot.SeriesCollection(2).Pen.Width = 25
.Plot.SeriesCollection(2).Pen.Style = VtPenStyleSolid '不显示第二条绿色线,只要红蓝
.Plot.SeriesCollection(3).Pen.Width = 20
.Plot.SeriesCollection(3).Pen.Style = VtPenStyleSolid
' '设置XY轴
.Plot.Axis(VtChAxisIdX).ValueScale.Auto = False
.Plot.Axis(VtChAxisIdY).ValueScale.Auto = False
'// 设置最大值
.Plot.Axis(VtChAxisIdX).ValueScale.Maximum = 1
.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = 2000
'// 设置最小值
.Plot.Axis(VtChAxisIdY).ValueScale.Minimum = 0
.Plot.Axis(VtChAxisIdX).ValueScale.Minimum = 0
'//
.Plot.Axis(VtChAxisIdX).ValueScale.MajorDivision = 12 'X轴主要网格数量
.Plot.Axis(VtChAxisIdY).ValueScale.MajorDivision = 10 'Y轴主要网格数量
.Plot.Axis(VtChAxisIdX).ValueScale.MinorDivision = 0 'X轴次要网格数量
.Plot.Axis(VtChAxisIdY).ValueScale.MinorDivision = 0 'Y轴次要网格数量
.Plot.Axis(VtChAxisIdX).AxisGrid.MajorPen.Style = VtPenStyleDotted
.Plot.Axis(VtChAxisIdY).AxisGrid.MajorPen.Style = VtPenStyleDotted
MSChart1.Plot.AutoLayout = True
MSChart1.Plot.UniformAxis = False
MSChart1.chartType = 1 '设置图形为线图
MSChart1.ChartData = MyData '数据
'设置R1-R13,其余以此类推。
.Row = 1
.RowLabel = "铣床"
.Row = 2
.RowLabel = "摩床"
.Row = 3
.RowLabel = "钻床"
End With
关于数据,你用sql读出来放在mydata中就行了,这很简单