回复 12楼 lianyicq
我改成20个之后,效果好点了,但我必须要600个采集点,一秒钟一个,我需要采集10分钟的数据,我的程序:
Dim mydata(20, 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 = 20 '设置横轴标注最大值
.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = 1000 '设置纵轴标注最大值
'// 设置最小值
.Plot.Axis(VtChAxisIdY).ValueScale.Minimum = 400
.Plot.Axis(VtChAxisIdX).ValueScale.Minimum = 0
.Plot.Axis(VtChAxisIdX).ValueScale.MajorDivision = 5 '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 255, 255, 255
'
For i = 1 To 600
''
.Row = i
'
.RowLabel = i
'
Next
.Refresh
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 > 20 Then
Timer1.Enabled = False
Else
Timer1.Enabled = True
End If
End Sub
效果如图:
图片附件: 游客没有浏览图片的权限,请
登录 或
注册
我只做了两条曲线,但显示的是3条并且还不是从x=0处开始的,有办法改吗 还有 我需要600个点 有办法完善吗
谢谢了
如果vb6.0用mschart控件画多条动态曲线有弊病的话,还有别的更好的方法实现吗 谢谢了