trying to draw a line graph
-
OK, Here's the deal. I have a dialog based MFC application and a large amount of data points (7296 of them actually) and I want to be able to graph these on a line graph on the dialog somewhere. One additional consern, I want to be able to do this from within a thread that is called frequently (every 8 ms). So here are the questions. 1. Is it possible? LOL. 2. What object type do I need to add to my dialog class to use functions like polyline, which I see in a lot of examples? All of the examples are not using a dialog based app. Can you even use those functions with a dialog app? oops I guess that was two quesitons. 4. Is that a good way to approach this or should I be looking for a library? 5. Any good free libraries you know of that do this?
-
OK, Here's the deal. I have a dialog based MFC application and a large amount of data points (7296 of them actually) and I want to be able to graph these on a line graph on the dialog somewhere. One additional consern, I want to be able to do this from within a thread that is called frequently (every 8 ms). So here are the questions. 1. Is it possible? LOL. 2. What object type do I need to add to my dialog class to use functions like polyline, which I see in a lot of examples? All of the examples are not using a dialog based app. Can you even use those functions with a dialog app? oops I guess that was two quesitons. 4. Is that a good way to approach this or should I be looking for a library? 5. Any good free libraries you know of that do this?
There are several graph components on codeproject. Plot Graphic Library[^] A 2D data visualisation class[^] A 2D Graph Component With Zoom Capability[^] -Saurabh
-
OK, Here's the deal. I have a dialog based MFC application and a large amount of data points (7296 of them actually) and I want to be able to graph these on a line graph on the dialog somewhere. One additional consern, I want to be able to do this from within a thread that is called frequently (every 8 ms). So here are the questions. 1. Is it possible? LOL. 2. What object type do I need to add to my dialog class to use functions like polyline, which I see in a lot of examples? All of the examples are not using a dialog based app. Can you even use those functions with a dialog app? oops I guess that was two quesitons. 4. Is that a good way to approach this or should I be looking for a library? 5. Any good free libraries you know of that do this?
As an alternative from the other reply: I also made a chart control (see my sig) and I think it can fulfill your needs. Some remarks though: if you plan to do that from a worker thread, a better approach would be to send a user-defined message to the dialog on which you have the graph instead of accessing the graph directly from your thread: MFC objects can't be shared across threads. Once you receive the message, you extract the point value out of it and plot it on the chart.
Cédric Moonen Software developer
Charting control [v1.4] OpenGL game tutorial in C++ -
OK, Here's the deal. I have a dialog based MFC application and a large amount of data points (7296 of them actually) and I want to be able to graph these on a line graph on the dialog somewhere. One additional consern, I want to be able to do this from within a thread that is called frequently (every 8 ms). So here are the questions. 1. Is it possible? LOL. 2. What object type do I need to add to my dialog class to use functions like polyline, which I see in a lot of examples? All of the examples are not using a dialog based app. Can you even use those functions with a dialog app? oops I guess that was two quesitons. 4. Is that a good way to approach this or should I be looking for a library? 5. Any good free libraries you know of that do this?
I have been going through all of the stuff you listed and I think at least something will work, I just haven't decided on what yet. Thanks
-
OK, Here's the deal. I have a dialog based MFC application and a large amount of data points (7296 of them actually) and I want to be able to graph these on a line graph on the dialog somewhere. One additional consern, I want to be able to do this from within a thread that is called frequently (every 8 ms). So here are the questions. 1. Is it possible? LOL. 2. What object type do I need to add to my dialog class to use functions like polyline, which I see in a lot of examples? All of the examples are not using a dialog based app. Can you even use those functions with a dialog app? oops I guess that was two quesitons. 4. Is that a good way to approach this or should I be looking for a library? 5. Any good free libraries you know of that do this?
aei_totten wrote:
Is that a good way to approach this or should I be looking for a library?
A simple line graph without 3D Vista spinning glitzery should be very simple to draw.
aei_totten wrote:
I want to be able to do this from within a thread that is called frequently (every 8 ms).
8 ms? That's an animation not a graph. I don't think that is very realistic unless it's part of game or something.
led mike
-
aei_totten wrote:
Is that a good way to approach this or should I be looking for a library?
A simple line graph without 3D Vista spinning glitzery should be very simple to draw.
aei_totten wrote:
I want to be able to do this from within a thread that is called frequently (every 8 ms).
8 ms? That's an animation not a graph. I don't think that is very realistic unless it's part of game or something.
led mike
led mike wrote:
8 ms? That's an animation not a graph. I don't think that is very realistic unless it's part of game or something.
Yes, it can be realistic: for example if you are receiving data from an external sensor that sends a point every 8 msec. Of course, the rendering won't be displayed every 8 msec because of the delays in the chain but the user won't see a difference (sometimes data will be enqueued and processed later for example).
Cédric Moonen Software developer
Charting control [v1.4] OpenGL game tutorial in C++ -
led mike wrote:
8 ms? That's an animation not a graph. I don't think that is very realistic unless it's part of game or something.
Yes, it can be realistic: for example if you are receiving data from an external sensor that sends a point every 8 msec. Of course, the rendering won't be displayed every 8 msec because of the delays in the chain but the user won't see a difference (sometimes data will be enqueued and processed later for example).
Cédric Moonen Software developer
Charting control [v1.4] OpenGL game tutorial in C++There's still no reason to redraw faster than a monitor is refreshing :) I'd personally save my CPU cycles for other work and throttle the redraws down to 25-50 FPS (even 50 would be overkill) - there wouldn't be any visible difference. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
There's still no reason to redraw faster than a monitor is refreshing :) I'd personally save my CPU cycles for other work and throttle the redraws down to 25-50 FPS (even 50 would be overkill) - there wouldn't be any visible difference. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
Mark Salsbery wrote:
There's still no reason to redraw faster than a monitor is refreshing
One 'reason' would be that the chart control you are using doesn't support refreshing at constant rate :). Most of the time, you add a point to a series and the control displays it immediately. But you can do that in a better way (like I did for my control for example :-D ): in the case of my chart control, adding a point to a series will only draw the missing segment. But of course that only happen under a certain condition: if the axes are not automatic for example (the control doesn't need to be refreshed in that case). Another solution would be to store those points in your application and draw several of them at a certain time. But then you'll need to use a timer to trigger the redrawing of the points (or a thread).
Cédric Moonen Software developer
Charting control [v1.4] OpenGL game tutorial in C++ -
Mark Salsbery wrote:
There's still no reason to redraw faster than a monitor is refreshing
One 'reason' would be that the chart control you are using doesn't support refreshing at constant rate :). Most of the time, you add a point to a series and the control displays it immediately. But you can do that in a better way (like I did for my control for example :-D ): in the case of my chart control, adding a point to a series will only draw the missing segment. But of course that only happen under a certain condition: if the axes are not automatic for example (the control doesn't need to be refreshed in that case). Another solution would be to store those points in your application and draw several of them at a certain time. But then you'll need to use a timer to trigger the redrawing of the points (or a thread).
Cédric Moonen Software developer
Charting control [v1.4] OpenGL game tutorial in C++Indeed! :) :beer:
Mark Salsbery Microsoft MVP - Visual C++ :java: