vc TeeChart 数据实时更新

w20011025 2010-06-26 02:49:41

char second[32] ="";
char one[7]="";
struct tm *temptm;
time_t temptime;
temptime= time(0);
temptm = localtime(&temptime);

sprintf(second,"%02d:%02d:%02d",temptm->tm_hour,temptm->tm_min,temptm->tm_sec);
while(m_Chart1.Series(0).GetCount()>50) m_Chart1.Series(0).Delete(0);
if(m_Chart1.Series(0).GetCount()>50) m_Chart1.Series(0).Delete(0);

newX=m_Chart1.Series(0).GetXValues().GetCount()+1;//
newY=GetRandom(100,300);
m_Chart1.Series(0).AddXY(newX,newY,second,RGB(255,255,0));


1。页面最多显示100个点温度曲线
2。根据时间测试一个点的温度数据实时更新(超过100个点的时候删除前面的点)
3。后面的温度曲线每秒向前移动一个温度曲线。
...全文
309 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
w20011025 2010-06-26
  • 打赏
  • 举报
回复
m_Chart1.GetAxis().GetBottom().SetAutomatic(TRUE);
已经改好。
w20011025 2010-06-26
  • 打赏
  • 举报
回复

char second[32] ="";
char one[7]="";
struct tm *temptm;
time_t temptime;
temptime= time(0);
temptm = localtime(&temptime);
sprintf(second,"%02d:%02d:%02d",temptm->tm_hour,temptm->tm_min,temptm->tm_sec);
sprintf(one,"%02d%02d%02d",temptm->tm_hour,temptm->tm_min,temptm->tm_sec);
while(m_Chart1.Series(0).GetCount()>50)m_Chart1.Series(0).Delete(0);
if(m_Chart1.Series(0).GetCount()>50)
{
m_Chart1.Series(0).Delete(0);
m_Chart1.GetAxis().GetBottom().SetAutomatic(TRUE);
}
if(m_Chart1.Series(0).GetXValues().GetCount()<1)
{
newX=m_Chart1.Series(0).GetXValues().GetCount()+1;//
}
else newX=m_Chart1.Series(0).GetXValues().GetLast()+1;
newY=GetRandom(100,300);
m_Chart1.Series(0).AddXY(newX,newY,second,RGB(255,255,0));

1.页面最多显示50个点温度曲线
2。根据时间测试一个点的温度数据实时更新(超过50个点的时候删除前面的点)
3。后面的温度曲线每秒向前移动一个温度曲线。
AlanBruce 2010-06-26
  • 打赏
  • 举报
回复
LZ想说什么??

我倒是知道一个绘制曲线的控件也很不错
ST_Curve

推荐一下
liutengfeigo 2010-06-26
  • 打赏
  • 举报
回复
顶个.

64,648

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

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