Click here to Skip to main content
16,020,378 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
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?
Posted
Updated 2-Mar-23 10:30am
v2

For drawing a chart, you can have a look at one of my article about a chart control: High-speed Charting Control[^].
 
Share this answer
 
Comments
Iain Clarke, Warrior Programmer 23-Aug-10 14:02pm    
Pretty much any charting answer is "look at Cedric's control" !

You da chart guy!

Iain.
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.
 
Share this answer
 
Comments
tuolesi 22-Aug-10 8:46am    
erm...i do noe the basic.

but is there anyway to make my drawing expendable?if i draw in a picturebox ..how do i make the drawing scrollable as my plotting may be very long..
Emilio Garavaglia 23-Aug-10 1:57am    
"i do noe the basic"
But you talk about "picture box" ...
tuolesi 23-Aug-10 11:20am    
erm...ok

if i draw it on a form window using paint event.
how can i draw outside of the form size and able to view it?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900