Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Real time QtCharts block the UI after few minutes



  • Hi,I am cross-programming a Qt application for an embedded device (iMX6 QUAD + 1GB RAM). I am trying to create a QApplication which uses QChart classes for generating real time charts. These charts must run and refresh for a maximum of 10 hours but I am facing the problem that after few minutes the UI is completely blocked.
    What I am doing is creating a QThread which sends signals with the new data to the QMainWindow which contains few QCharts that must be refreshed. The QCharts have a X dimension that when there is more data, the chart must scroll right.
    My appending function core is composed by the following:

    if(reachedMaximumRight){
        QPointF p(xIndex, dataY);
        m_series[sIndex]->remove(0); 
        m_series[sIndex]->append(p);
        m_axisX->setRange(xIndex-maxXElements, xIndex);
    }else{
        QPointF p(xIndex, dataY);
        m_series[sIndex]->append(p);
    }
    

    What am I doing wrong? It seems that the chart doesn't removes old points and the UI cannot handle such heavy chart but I am not sure.
    PS: I have found a library called QWT, could it suit better for my purposes?

    PPS: I have followed the basic dynamic chart example (here)