Real-time QtChart graph with QLineSeries slow down



  • 890/5000
    Hi, I'm doing a temperature graph with a QtChart.

    This graph contains 3 QLineSeries of maximum, average and minimum temperature that are updated every second. The update of the data is done in a QFuture where the new data is added to a QVector of QPointF and then added to the series through the replace function.

    The axes are adaptive. Each time a data arrives, the limits of the Y axis are calculated. The size of the X axis is also checked. If it is greater than 5 min, the start and end of the X axis is moved 1 second to maintain a 5 minute window . This task is done through the setRange function of the X axis of the QChart.

    After an hour the graph starts to slow down. This slowdown influences even the main interface.
    Any idea how to optimize the behavior of the graph and solve the slowdown?


  • Qt Champions 2019

    @zedhzelgc Did you try to profile your app?
    Did you check memory consumption of your app (could be memoryleak)?



  • @zedhzelgc said in Real-time QtChart graph with QLineSeries slow down:

    Any idea how to optimize the behavior of the graph and solve the slowdown?

    Yes, of course, just use Qwt and don't use QtCharts.



  • @jsulm I had the graph over an hour and the memory did not increase but the program started to slow down.



  • Hello,
    I tried the library qwt and saw that the slowdown effect did not occur.
    Update all my code to adapt it to the qwt library and once integrated, no type of slowdown occurs even after a couple of days. Also this library allowed me to insert better visual effects.

    Thanks for the help.