[Development] Qt Charts poor dynamic/resolution with OpenGL

jeandet alexis.jeandet at member.fsf.org
Tue Jul 19 19:26:27 CEST 2016

Hi All,

We are developing in my lab a scientific data plot/analysis software
using Qt Charts module. In order to plot quite large data-sets
(XYSeries) we enabled OpenGL which produce unexpected behavior. The
plots values are grouped by X values see here:
-Plot0 with OpenGL
-Plot1 without OpenGL

We found that it was due to float conversion with OpenGL, as far as I
know we can't safely use doubles with OpenGL since not al GPU/drivers
support it(and it increase version requirement). So for now it really
limits plots quality since float has a 23+1 bits mantissa so +/-8M
relative dynamic.

For example data with X values representing seconds since epoch(1970)
would have to store:
(2016-1970)*365*24*60*60 = 1450656000 seconds ~2^31
This indeed doesn't fit in 23 bits, to store it in a float you will
need to truncate it and you would get something close to 3 minutes
Here is a tool to see what append.

It will also fail with  non uniform X values, packets of data with a
small dX spaced by bigger dX. For example 8kSps time series grouped in
packets of 1000 points with few minutes between each packets would

That said there seems to be solutions to make the situation better. 
I think that before plotting te data we should perform a coordinate
change to fit float dynamic.
This pipeline might be implemented like this?:

CPU:  -Data domain analysis (min, max, dynamic)
CPU:  -Produce a Temporary vector of visible data centered and reduced
CPU:  -Push Temporary vector to GPU
GPU:  -Generate Vertices with or without downsampling strategy
CPU:  -Build Axes from visible bounds in data coordinates

Note that this would also work without OpenGL and the downsampling
insanely increase performances. On QCustomPlot if we replace data
containers which are QMap by QVector you can plot more than 10M points
without problems.
Here is one example with 3M points with QCustomPlot and without OpenGL:

This would imply to store two coordinate systems for Data and View.
We are happy to discuss about that and contribute to the development if
we agree on a solution.
Anyway I would be happy to have any feedback on this.

Some readings:

Best regards
Alexis Jeandet
Laboratory of Plasma Physics(LPP)

More information about the Development mailing list