PDA

View Full Version : plotting 2d graphs with zoom/pan - lots of data



guitargirl
22nd April 2015, 03:20
Hi,

I am relatively new to Qt and was planning to use QT Creator to develop a user interface. My interface involve 5-6 x/y plots on each form. Each plot may have several lines (maybe up to 6) and each line on the plot may be made up of around 1000000 points. This is trying to approximate worst case - many plots only have 1 line but the number of points per line typical. Also, the plots have to have zoom/pan capability.

I have located at least 2 libraries for this Qwt and QCustomPlot. Reviewing others posts as of ~2 yrs ago - Qwt did better for large data applications and zoom/pan. Where does that stand today? If I have to scale back to display less data to improve interactivity with the UI, for each of the products what would be reasonable? Are there other tools that I should consider?

d_stranz
22nd April 2015, 16:12
Use Qwt. We use Qwt 5.x for plotting scientific data where a line can routinely have 1 million points. We have developed some custom line types where painting is optimized based on level of detail (eg. compress multiple line segments into a single one if one of the coordinates isn't changing - this can easily happen with 1 million point lines when you try to put that many x values into a 1000 pixel range).

Qwt 6.x is much different from 5.x, and as a result the overhead to port all of our code is more than we are willing to do. If you are just starting out, use the current Qwt 6.x version.

Qwt also has a liberal license; QCustomPlot is GPL only, which precludes using it in a commercial app without a license if that makes a difference for you.

guitargirl
22nd April 2015, 18:43
Thanks for your response. That was my 1st inclination due to licensing, but I had read that if you contact the owner of QCustomPlot that he has given LGPL licenses for a donation in the past. So my 1st priority was feedback on the technical considerations.

My project is not complex other than the large amounts of data, but has a very quick turn around time so hopefully the documentation won't be a hinderance. I did note the forum for qwt here which should be very helpful.

Thanks again:)

d_stranz
23rd April 2015, 02:25
Thanks for the information concerning QCustomPlot and LGPL licenses. That's good to know.

Although I haven't gotten far enough into studying QCustomPlot, my conclusion was that the "graph" object (which corresponds to a single line in a plot) makes a copy of the data that defines the x and y values. While this may be fine for a few hundred points or so, it isn't good for a million of them. In Qwt, I was able to devise a custom line object that stored smart pointers to the arrays of my data. In that way, there is only a single copy of the data, not a copy for every plot in which it is displayed as well as for manipulation by the program during calculations. It might be possible to do this in QCustomPlot also, but as I said, I already had a Qwt solution and didn't get deep enough into QCustomPlot to find out.

If your data is also that large, you'll have to think about that as well.