By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,295 Members | 1,552 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,295 IT Pros & Developers. It's quick & easy.

Drawing a Graph (value vs time)

P: n/a

Hi,

I'm new to C++ and i can't seem to find a tutorial on the net for this
one.

I have a dialog based MFC app running that reads sensors using a USB
interface device.

At the moment the varying data just moves a progress bar up and down.
I'm looking for a way to display this sensor data as a graph on the
screen. There are variables in my program that chenge as the sensor
reading changes, so all i need to do is plot this against time on a
line graph.
Here is some pseudocode for an example;

prognameDlg::OnTimer()
{
sensor1 = readData();
plot x,sensor1;
x++;
}

Code like this would just plot points as it moved along the screen. I'm
guessing this should be quite simple, but i dont even know where to
start.

I suppose i need some sort of control or frame for the graph. I also
need to know how to draw the lines in it and make it scroll or restart
from the beginning.

Please can someone let me know where to start, or post a link to a
tutorial if you know of one.

Thanks,
RichMo

--
RichMo
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

May 31 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
> I'm new to C++ and i can't seem to find a tutorial on the net for this
one.

I have a dialog based MFC app running that reads sensors using a USB
interface device.

At the moment the varying data just moves a progress bar up and down.
I'm looking for a way to display this sensor data as a graph on the
screen. There are variables in my program that chenge as the sensor
reading changes, so all i need to do is plot this against time on a
line graph.
Here is some pseudocode for an example;

prognameDlg::OnTimer()
{
sensor1 = readData();
plot x,sensor1;
x++;
}

Code like this would just plot points as it moved along the screen. I'm
guessing this should be quite simple, but i dont even know where to
start.

I suppose i need some sort of control or frame for the graph. I also
need to know how to draw the lines in it and make it scroll or restart
from the beginning.

Please can someone let me know where to start, or post a link to a
tutorial if you know of one.


Hi,

Maybe this can help you :
http://www.codeproject.com/miscctrl/ntgraph_activex.asp
create a buffer in which you store data as it is coming in, and then
update the graph accordingly.

if you are new to C++, then I can recommend www.codeproject.com
as a good place to search for tutorials and articles.

--

Kind regards,
Bruno van Dooren
br**********************@hotmail.com
Remove only "_nos_pam"
Jun 1 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.