MSChart画时间-温度曲线图

xflg2006 2009-10-19 05:56:53
在VB中是使用MSChart画二维散点图,每三分钟读一个数据并画一个点,X坐标代表时间,Y坐标是数据值,最后是一个连续的曲线图。如何编程实现?
请高手帮忙!
请详细点说明……
拜谢!
...全文
794 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhengqingbo1987 2010-12-14
  • 打赏
  • 举报
回复
我啥都不会,画温度随时间变化曲线该怎么弄呀?
lcm16001080 2010-12-08
  • 打赏
  • 举报
回复
急用啊,积分不够没法下载例子,有好心人,能不能传我一份。邮箱是:lcm16001080@163.com
谢谢。
Tiger_Zhao 2009-10-20
  • 打赏
  • 举报
回复
http://topic.csdn.net/u/20080604/14/7b4ac419-0927-4df9-8c54-67d58f2507b5.html
http://topic.csdn.net/u/20070827/14/2fe4e025-70c7-419e-ab24-55030bcf0634.html
zdingyun 2009-10-20
  • 打赏
  • 举报
回复
Private Sub Timer2_Timer() '每180秒画一点,可依据需要改变画点周期
If Label1 <> CStr(Time$) Then
Label1.Caption = Time$
sum_z = sum_z + 1
'校准
If sum_z >= 360 Then
sum_z = sum_z - 360
sum_z1 = sum_z1 + 1
End If
End If
End Sub
xflg2006 2009-10-20
  • 打赏
  • 举报
回复
- - !
大哥,怎么修改画点时间啊?
zdingyun 2009-10-20
  • 打赏
  • 举报
回复
使用Picture1.PSet方法绘图:
Option Explicit
Dim sum_z As Integer
Dim sum_z1 As Integer
Dim colvb As Long
Dim xx As Integer
Dim yy As Integer
Dim txt As String
Dim wp As Long
Dim i As Integer
Dim record_jm(6) As Single '可将本变量在标准模块中定义为全局变量
Private Sub Form_Load()
Timer1.Interval = 500
Timer2.Interval = 500
Picture1.BackColor = vbWhite
Picture1.AutoRedraw = True
colvb = vbBlack
xx = 100
yy = 150
txt = "℃"
wp = xp(colvb, xx, yy, txt)
xx = 200
yy = 350
txt = "50"
wp = xp(colvb, xx, yy, txt)
xx = 200
yy = 1850
txt = "40"
wp = xp(colvb, xx, yy, txt)
yy = 3350
xx = 200
txt = "30"
wp = xp(colvb, xx, yy, txt)
xx = 200
yy = 4850
txt = "20"
wp = xp(colvb, xx, yy, txt)
xx = 200
yy = 6350
txt = "10"
wp = xp(colvb, xx, yy, txt)
'Time坐标
colvb = vbRed
yy = 6500
xx = 400
txt = "0"
wp = xp(colvb, xx, yy, txt)
xx = 1480
txt = "5"
wp = xp(colvb, xx, yy, txt)
xx = 2560
txt = "10"
wp = xp(colvb, xx, yy, txt)
xx = 3640
txt = "15"
wp = xp(colvb, xx, yy, txt)
xx = 4720
txt = "20"
wp = xp(colvb, xx, yy, txt)
xx = 5800
txt = "25 min"
wp = xp(colvb, xx, yy, txt)
xx = 6880
txt = "30"
wp = xp(colvb, xx, yy, txt)
xx = 7960
txt = "35"
wp = xp(colvb, xx, yy, txt)
xx = 9040
txt = "40"
wp = xp(colvb, xx, yy, txt)
xx = 10120
txt = "45"
wp = xp(colvb, xx, yy, txt)
xx = 11200
txt = "50"
wp = xp(colvb, xx, yy, txt)
'画格
For i = 0 To 39
Picture1.Line (450, 550 + i * 150)-(500, 550 + i * 150)
Next
Picture1.DrawStyle = 2
For i = 0 To 8
Picture1.Line (450, 400 + i * 750)-(11300, 400 + i * 750)
Next
For i = 0 To 15
Picture1.Line (450, 1000 + i * 300)-(500, 1000 + i * 300)
Next
For i = 0 To 10
Picture1.Line (500 + i * 1080, 400)-(500 + i * 1080, 6400)
Next
Picture1.DrawStyle = 0
End Sub

Public Function xp(colvb As Variant, xx As Variant, yy As Variant, txt As Variant)
Picture1.ForeColor = colvb 'QBColor(14)
Picture1.CurrentX = xx
Picture1.CurrentY = yy
Picture1.Print txt '
End Function

Private Sub Timer1_Timer()
Picture1.DrawStyle = 0
'画图变量,可由程序的其它窗体接收后传递过来。
record_jm(0) = 12
record_jm(1) = 20
record_jm(2) = 42
record_jm(3) = 32
record_jm(4) = 35
record_jm(5) = 48
Picture1.DrawWidth = 3
Picture1.PSet (sum_z1 * 18 + 500, record_jm(0) * -150 + 7900), vbRed
Picture1.PSet (sum_z1 * 18 + 500, record_jm(1) * -150 + 7900), vbCyan
Picture1.PSet (sum_z1 * 18 + 500, record_jm(2) * -150 + 7900), vbBlack
Picture1.PSet (sum_z1 * 18 + 500, record_jm(3) * -150 + 7900), vbMagenta
Picture1.PSet (sum_z1 * 18 + 500, record_jm(4) * -150 + 7900), vbGreen
Picture1.PSet (sum_z1 * 18 + 500, record_jm(5) * -150 + 7900), vbBlue
End Sub

Private Sub Timer2_Timer() '每2.5秒画一点,可依据需要改变画点周期
If Label1 <> CStr(Time$) Then
Label1.Caption = Time$
sum_z = sum_z + 1
'校准
If sum_z >= 5 Then
sum_z = sum_z - 5
sum_z1 = sum_z1 + 1
End If
End If
End Sub
xflg2006 2009-10-20
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 getemail 的回复:]
LZ是要示波器那样动起来的
说清楚不容易

引用 2 楼 of123 的回复:
直接用 MSChart “绑定”二维数组,是最省事的方法。


[/Quote]


不用那么费劲,是要能把点阵图画出来就行,功能实现了,我再做其他的修改……
拜托说的详细点,刚学VB,真的很急!
xflg2006 2009-10-20
  • 打赏
  • 举报
回复
老鸟给的东西很好,很受用!谢谢!
xflg2006 2009-10-20
  • 打赏
  • 举报
回复
zdingyun你的代码的确可以做实时监控描点,谢谢!
坐标都是手动画的,麻烦了一些……
贝隆 2009-10-19
  • 打赏
  • 举报
回复
getemail 2009-10-19
  • 打赏
  • 举报
回复
参看这个
getemail 2009-10-19
  • 打赏
  • 举报
回复
LZ是要示波器那样动起来的
说清楚不容易

[Quote=引用 2 楼 of123 的回复:]
直接用 MSChart “绑定”二维数组,是最省事的方法。

[/Quote]
of123 2009-10-19
  • 打赏
  • 举报
回复

直接用 MSChart “绑定”二维数组,是最省事的方法。
getemail 2009-10-19
  • 打赏
  • 举报
回复
帮顶

1,451

社区成员

发帖
与我相关
我的任务
社区描述
VB 控件
社区管理员
  • 控件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧