QCustomPlot Discussion and Comments

How to improve plot performance?Return to overview

Hi!

I have fairly large plots, let's say an average of 3 dozens of plots, each with 10,000 points.
That's when I only load 1 file, and I can load 2 or 3 at the same time...

I only load the data that is visible (like the first ten second of data).
I only call replot() when necessary (when new data should be visible), and I unload data that should no longer be visible.
I don't use complex plot customization (line plot filing, big pen size...). I just color the plot from different file in diffenret color.
Also, there's nothing else running in background, whether on the computer or in the application itself.

The amount of data is just that big, and it is quite slow even when I only have one file loaded.
Is there some tricks to improve the performance? Or is it just an hardware limitation?

30000 points is easy for qcustomplot

Indeed. But each plot have around 10,000 points, and I can have around three dozen of them, at minima. And that's 360,000 points.
Sure, QCustomPlot can handle that, but it can take up to half a second to display. And that's for the minimum amount of data I want to display.
It's not very slow, but if I can improve performance even for a little bit, I'll do it.

its calced / rendered on the cpu so it wont be faster unless you make it.
you can either patch QCustomPlot lib to paint like it does (using QPainter) but make it batch things or go to hardware accelerated way and write native opengl rendering code - this way you can make it render in just 1-3 ms.

see for reference:
https://www.qcustomplot.com/index.php/support/forum/1895

the code there is very old and uses fixed opengl funcs - now i have ver that uses modern opengl. but it shall give you idea.

Hey miccs, that sounds very useful. Any chance you could share some of what you did for your version with modern opengl?

I see, thanks!
I'll look into it.

@Aero
we have written renderer classes that are very specific to our tool so it wouldnt make sense to post it here since it wont work for you like that.
we dont patch qcustomplot lib anymore except for changing some funcs from private/protected to public as we are doing all the drawing (even QCP items).

our solution works for bar charts since thats all we need - a general solution for all the charts would need to be implemented in QCustomPlot itself which i dont think will happen as its not a high-performance charting lib.

so that old forum topic is best bet for ya since its from times when we were patching the lib.
also its only for the bar charts - but it should be pretty easy to implement it for a chart of your choice.

by bar charts i've meant candlestick bar charts - not that it matters alot :)

check out the qt 6.2 version - as it improves the rendering speed a lot (without doing anything on your side)