回复 8楼 lianyicq
按照你说的方法我又试了一下,程序如下:Dim mydata(600, 2)
Dim i As Single
Private Sub Form_Load()
With MSChart1
.TitleText = "压强变化 kpa/s"
' '设置图线的外观
.Plot.SeriesCollection(1).Pen.Width = 30
.Plot.SeriesCollection(1).Pen.Style = VtPenStyleSolid
.Plot.SeriesCollection(2).Pen.Width = 30
.Plot.SeriesCollection(2).Pen.Style = VtPenStyleSolid
' .Plot.SeriesCollection(3).Pen.Width = 30
' .Plot.SeriesCollection(3).Pen.Style = VtPenStyleSolid
' '设置XY轴
.Plot.Axis(VtChAxisIdX).ValueScale.Auto = False
.Plot.Axis(VtChAxisIdY).ValueScale.Auto = False
'// 设置最大值
.Plot.Axis(VtChAxisIdX).ValueScale.Maximum = 600 '设置横轴标注最大值
.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = 1000 '设置纵轴标注最大值
'// 设置最小值
.Plot.Axis(VtChAxisIdY).ValueScale.Minimum = 400
.Plot.Axis(VtChAxisIdX).ValueScale.Minimum = 0
.Plot.Axis(VtChAxisIdX).ValueScale.MajorDivision = 6 'X轴主要网格数量
.Plot.Axis(VtChAxisIdY).ValueScale.MajorDivision = 6 '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
' .Plot.Axis(VtChAxisIdY).AxisTitle = "压强(kpa)"
.Plot.Axis(VtChAxisIdX).AxisTitle = "时间(s)"
MSChart1.Plot.AutoLayout = False
MSChart1.Plot.UniformAxis = False
MSChart1.chartType = VtChChartType2dLine
'VtChChartType2dXY '设置图形为二维散点图
' MSChart1.ChartData = mydata
'MSChart1.Backdrop.Fill.Style = VtFillStyleBrush
'MSChart1.Backdrop.Fill.Brush.FillColor.Set 0, 0, 0
' For i = 1 To 600
'' .Row = i
' .RowLabel = i
' Next
End With
End Sub
Private Sub Timer1_Timer()
mydata(1, 0) = 0
mydata(i, 0) = i
mydata(1, 1) = 700
mydata(i, 1) = 700
mydata(1, 2) = 500
mydata(i, 2) = 500
MSChart1.ChartData = mydata
i = i + 1
If i > 600 Then
Timer1.Enabled = False
Else
Timer1.Enabled = True
End If
End Sub
效果如下:
不知道 是哪里的问题 就是图表显示的不清楚 我需要怎么改 谢谢了