[Development] Qt Charts poor dynamic/resolution with OpenGL

Sean Harmer sean.harmer at kdab.com
Tue Jul 19 21:26:57 CEST 2016

On 19/07/2016 18:26, jeandet wrote:
> 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:
> https://ao.lpp.polytechnique.fr/s/T2HcZDtrdL0DcDi
> passwd:àààà
> -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
> resolution.
> Here is a tool to see what append.
> http://babbage.cs.qc.cuny.edu/IEEE-754.old/Decimal.html
> 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
> fail.
> 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

That's essentially the same strategy I've implemented in the past. I 
don't know the code of Qt Charts or how easily this woudl fit into it 
but as an approach I think it's sound.



> 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:
> https://hephaistos.lpp.polytechnique.fr/data/QLop_new_Features2.webm
> 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:
> http://blogs.agi.com/insight3d/index.php/2008/09/03/precisions-precisio
> ns/
> http://www.urbanrobots.com/Blogs/WW/2006/01/working-to-solution-in-prec
> ision.html
> http://www.urbanrobots.com/Blogs/WW/2006/01/solving-coordinate-precisio
> n-problems.html
> Best regards
> Alexis Jeandet
> Laboratory of Plasma Physics(LPP)
> http://www.lpp.fr/?lang=en
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development

Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
KDAB (UK) Ltd, a KDAB Group company
Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
Mobile: +44 (0)7545 140604
KDAB - Qt Experts

More information about the Development mailing list