QChart realtime performance
-
Hi, I am using QChart for an application. The application need to show some data realtime. There will be one chart and 24 series in the chart. The data rate is
400pts
for every channel.I used another thread for receiving and processing received data and emit the processed data to a slot for append datas to update the chart series.
I refered to https://doc.qt.io/qt-5/qtcharts-audio-example.html. In my case, each series is limited to 2000 points, if the number of points in the series is less than 2000, add the new point to the series, if the number of points in the seried is more than 2000, delete first point, move the rest of datas to left and add the new point in the end. This will make the chart look like move from right to left.
For good performance, I also used
series->replace()
andseries->setUseOpenGL(true)
.My problem is that the application will get freezed soon when it started. I tried delete the codes of update the chart, everything looked fine. Could anyone help me how to improve the performance of update the chart?
Thanks!
-
Hi, I am using QChart for an application. The application need to show some data realtime. There will be one chart and 24 series in the chart. The data rate is
400pts
for every channel.I used another thread for receiving and processing received data and emit the processed data to a slot for append datas to update the chart series.
I refered to https://doc.qt.io/qt-5/qtcharts-audio-example.html. In my case, each series is limited to 2000 points, if the number of points in the series is less than 2000, add the new point to the series, if the number of points in the seried is more than 2000, delete first point, move the rest of datas to left and add the new point in the end. This will make the chart look like move from right to left.
For good performance, I also used
series->replace()
andseries->setUseOpenGL(true)
.My problem is that the application will get freezed soon when it started. I tried delete the codes of update the chart, everything looked fine. Could anyone help me how to improve the performance of update the chart?
Thanks!
@jiong said in QChart realtime performance:
400pts
What is this? Do you mean you get the data 400 times per second? It makes no sense to update the charts that often as no display can update so fast. Most display have a refresh rate of 60Hz.
-
@jiong said in QChart realtime performance:
400pts
What is this? Do you mean you get the data 400 times per second? It makes no sense to update the charts that often as no display can update so fast. Most display have a refresh rate of 60Hz.
-
Hi, I am using QChart for an application. The application need to show some data realtime. There will be one chart and 24 series in the chart. The data rate is
400pts
for every channel.I used another thread for receiving and processing received data and emit the processed data to a slot for append datas to update the chart series.
I refered to https://doc.qt.io/qt-5/qtcharts-audio-example.html. In my case, each series is limited to 2000 points, if the number of points in the series is less than 2000, add the new point to the series, if the number of points in the seried is more than 2000, delete first point, move the rest of datas to left and add the new point in the end. This will make the chart look like move from right to left.
For good performance, I also used
series->replace()
andseries->setUseOpenGL(true)
.My problem is that the application will get freezed soon when it started. I tried delete the codes of update the chart, everything looked fine. Could anyone help me how to improve the performance of update the chart?
Thanks!
@jiong said in QChart realtime performance:
My problem is that the application will get freezed soon when it started
This will not improve the performance of the actual chart point updating, but if you mean the app freezes in the sense of no interaction/update you may find you need to
QApplication::processEvents()
at various times (e.g. after every 40 samples) if you mean you are not allowing that to run for UI input events already. -
@jsulm Thanks for your reply. 400pts means reveiving 400 data points per second for each series.
-
@jiong You should not try to update the chart 400 times per second as it does not make sense. Instead do it like 24-60 times per second.
-
@jiong You should not try to update the chart 400 times per second as it does not make sense. Instead do it like 24-60 times per second.
-
@jsulm
Could you kindly explain why you say "as it does not make sense", rather than, say, "it is not efficient"? -
@JonB What is the point to update the chart 400 times per second if the refresh rate of the display is 60Hz? A movie has typically a refresh rate of 24Hz - for human eye this is already smooth.
-
@jsulm Fine, that's what I thought you had in mind. [FWIW, apes apparently have vastly faster image perception, so they might appreciate the 60 times per second ;-) ]
-
@jsulm Till the OP specifies otherwise, I assume a Qt app's audience potentially includes any sentient being.... For all I know his app is part of experimental animal research. :) I have watched orang-utans interacting with PC screens at Washington DC Zoo...
-
@jsulm Till the OP specifies otherwise, I assume a Qt app's audience potentially includes any sentient being.... For all I know his app is part of experimental animal research. :) I have watched orang-utans interacting with PC screens at Washington DC Zoo...
-
@jsulm Which is why I said they might appreciate the 60 times per second rather than the 24. Though not the 400.
[Incidentally, have a look at https://books.google.co.uk/books?id=r4xywWpmXSEC&pg=PA15&lpg=PA15&dq=ape+vision+speed&source=bl&ots=ZGKKPG_adk&sig=qOypYm-Pg8rVfpsZ3hvdkMOR_2k&hl=en&sa=X&ved=0ahUKEwiOs8eu2tXbAhVrLcAKHVefAgQQ6AEIjAEwDw#v=onepage&q&f=true for just how much work is being done for ape-communication with software!]
I didn't mean to hijack this thread. I think the OP is still awaiting a further answer for:
@jiong
But, I have another problem, how could I update all the 24 series in a signle operation and cause a single repaint of the chart? -
@jsulm Thanks for your great suggestion. It's better when I tried your method. But, I have another problem, how could I update all the 24 series in a signle operation and cause a single repaint of the chart?
Thanks again.
@jiong said in QChart realtime performance:
. But, I have another problem, how could I update all the 24 series in a signle operation and cause a single repaint of the chart?
You should have a read of https://stackoverflow.com/questions/38804179/how-to-repaint-a-qchart for your situation (which, incidentally, "append points at 400000 pts/sec", making your speed look trivial!).