在折线图中显示数据 [英] show data in line graph

查看:156
本文介绍了在折线图中显示数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个伺服电机,它在运行时反馈其速度.
我希望创建一个可以以图形方式显示速度数据的窗口-
就像Windows任务管理器中的CPU使用历史一样...

I have a servo motor which feeds back its velocity while running.
I wish to make a window that can show the velocity data graphically -
just like the CPU usage history in windows task manager...

Any idea on how to make this?

推荐答案

要绘制图表,可以看看我的一篇有关图表控件的文章:
For drawing a chart, you can have a look at one of my article about a chart control: High-speed Charting Control[^].


分配循环缓冲区,使用计时器对值进行采样(让'例如... 1/10秒?),然后将值排队在缓冲区中,扔掉最早的.

同时,使窗口无效,并绘制一条线,该线的振幅与最大期望值成比例,且与窗口高度有关.

如何在Windows上的C ++中做到这一点……我想您已经具备了基础知识,否则,我看不出您负担不起什么编程问题.
Allocate a circular buffer, sample the value with a timer (let''s say ... 1/10 of a second ?) and queue the values in the buffer, throwing away the oldest.

At the same time, invalidate a window, and paint a line whose amplitude is proportional to the maximum expected value, respect to the window height.

How to do that in C++ over windows ... I suppose you have the basics, otherwise, I don''t see how ca you afford whatever programming problem.


这篇关于在折线图中显示数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆