[Interest] Dealing with large data sets with QtCharts

Benjamin TERRIER b.terrier at gmail.com
Mon Nov 6 10:42:16 CET 2017


2017-11-05 14:37 GMT+01:00 iman ahmadvand <iman72411 at gmail.com>:
> Hi everyone.
>
> I was wonder if it's possible to manage large data sets with qchart ?

What do you mean by "large data sets" ? How many points ?

> The consuming operation is a loop for adding points to QLineSeries + adding
> each series to QChart.
>
> Since QChart is a view on it's own and unfortunately data sets are
> integrated inside the view so it can't be used in another background worker
> at all, so what is the possible solution to keep GUI responsive while
> feeding the chart ?
>
> Note that QCoreApplication::processEvents() doesn't help this situation

This is not the same issue as "large data sets", you are talking about updating
the chart while the GUI run. The critical parameter is how many points
per second
do you want to add to the ?

Anyway, I have played a bit with QtCharts. For large data sets (100k+ points),
the drawing performance degrades and you have to enable OpenGL acceleration.
This gives a huge boost in performances but reduce the customization options.
Also it seems there is a limit to how many point you can have.

For updating you chart while keeping the ui responsive, you can have a "feeder"
in another thread that will send the data using signals. The chart
will receive the data
asynchronously in a slot. The signal/slot being connected with
Qt::QueuedConnection.

You can even have your worker waits for the UI with
Qt::BlockingQueuedConnection, so
that you do not fill the event queue.

Br,

Benjamin



More information about the Interest mailing list