I'm writing application which would plot a realtime graph with approx 2000 data point per second.
I'm using version from this github which looks like latest https://github.com/iwbnwif/wxFreeChart
The code I'm using comes from the sample XY number 5 - dynamic data just increased points from 200 to 2000 and it looks like it can't handle that much of a refresh rate - on i7 processor I get max usage of one core and the graph has many slowdowns.
Is there any way around it?
wxFreeChart realtime plot
Re: wxFreeChart realtime plot
Hi,
Are you able to profile it?
At which point you can see the slowdown? 1000? 5000? More?
Can you try to find the bottleneck?
Also - are you sure you release all graphical resources properly?
Thank you.
Are you able to profile it?
At which point you can see the slowdown? 1000? 5000? More?
Can you try to find the bottleneck?
Also - are you sure you release all graphical resources properly?
Thank you.
Re: wxFreeChart realtime plot
I don't have any experience with profiling, but the slowdown is noticable even with the original value in the wxFreeChart example - 200 points.
You said about releasing graphical resources, is it possible to do it outside of library? I don't see it mentioned in the documentation.
You said about releasing graphical resources, is it possible to do it outside of library? I don't see it mentioned in the documentation.
Re: wxFreeChart realtime plot
Hi,
I don't think it is possible for wxFreeChart to update at this rate because of the underlying way in which it works. Also, it is single threaded currently.
The best option is for you to capture your data points into your own buffer and then update the chart at a much slower speed (if you want to see dynamic updates).
I have seen a very fast drawing chart for wxWidgets as part of the GNURadio project (https://www.gnuradio.org/). I believe that it uses OpenGL, but even then I think you would need to add a buffer because 2000 frames a second would be pretty intensive and the visible update rate probably only needs to be in the order of 30 - 60 frames / sec.
I don't think it is possible for wxFreeChart to update at this rate because of the underlying way in which it works. Also, it is single threaded currently.
The best option is for you to capture your data points into your own buffer and then update the chart at a much slower speed (if you want to see dynamic updates).
I have seen a very fast drawing chart for wxWidgets as part of the GNURadio project (https://www.gnuradio.org/). I believe that it uses OpenGL, but even then I think you would need to add a buffer because 2000 frames a second would be pretty intensive and the visible update rate probably only needs to be in the order of 30 - 60 frames / sec.
wxWidgets 3.1.2, MinGW64 8.1.0, g++ 8.1.0, Ubuntu 19.04, Windows 10, CodeLite + wxCrafter
Some people, when confronted with a GUI problem, think "I know, I'll use Eclipse RCP". Now they have two problems.
Some people, when confronted with a GUI problem, think "I know, I'll use Eclipse RCP". Now they have two problems.
Re: wxFreeChart realtime plot
Thank you for answer. I see it now. If I would slow the refresh rate down to about 50FPS like in the example from wxFreeChart package it is also not smooth, so from what you say that also can't be helped?
Re: wxFreeChart realtime plot
If it is a smooth scrolling display that you are trying to achieve, then I think it would be quite hard to do with the current wxFreeChart. That is because it is basically designed to draw multipurpose charts similar to Microsoft Excel.
To achieve smooth scrolling, then the whole chart area needs to move one pixel right (for a left scroll) at a relatively fixed rate. At the moment, the background of the chart is assumed to be more or less static and the data lines are plotted on top of it. That means the entire chart is redrawn for each update.
It would be nice to have the smooth scroll function that you describe, but I am afraid that it is probably too much work for me to undertake at the moment!
To achieve smooth scrolling, then the whole chart area needs to move one pixel right (for a left scroll) at a relatively fixed rate. At the moment, the background of the chart is assumed to be more or less static and the data lines are plotted on top of it. That means the entire chart is redrawn for each update.
It would be nice to have the smooth scroll function that you describe, but I am afraid that it is probably too much work for me to undertake at the moment!
wxWidgets 3.1.2, MinGW64 8.1.0, g++ 8.1.0, Ubuntu 19.04, Windows 10, CodeLite + wxCrafter
Some people, when confronted with a GUI problem, think "I know, I'll use Eclipse RCP". Now they have two problems.
Some people, when confronted with a GUI problem, think "I know, I'll use Eclipse RCP". Now they have two problems.
Re: wxFreeChart realtime plot
Recently I came across the modification called wxFreeChartNg http://tk-open-systems.com/en/projects/wxFreeChart.html
It has something called "adding mode" which supposedly would handle multiple realtime data but it is outdated.
I compaded the sources and it mostly has most differences in the XY renderer.
Is it possible that this feature would be merged in the near future?
It has something called "adding mode" which supposedly would handle multiple realtime data but it is outdated.
I compaded the sources and it mostly has most differences in the XY renderer.
Is it possible that this feature would be merged in the near future?
Re: wxFreeChart realtime plot
Hmm, interesting. I didn't find that version before.
I may have a look at it, but at the moment the priority for me is to improve the documentation and implement zooming and panning - sorry.
I may have a look at it, but at the moment the priority for me is to improve the documentation and implement zooming and panning - sorry.
wxWidgets 3.1.2, MinGW64 8.1.0, g++ 8.1.0, Ubuntu 19.04, Windows 10, CodeLite + wxCrafter
Some people, when confronted with a GUI problem, think "I know, I'll use Eclipse RCP". Now they have two problems.
Some people, when confronted with a GUI problem, think "I know, I'll use Eclipse RCP". Now they have two problems.