Nominate our 2022 Qt Champions!

Webassembly QtChart not refreshing

  • Hi!
    I have created two test applications, a websocket server, which generates random temperature data, and sends it to the connected clients as json, and the other is a qt charts application, which updates the chart x axis on receiving the new datetime & temperature data. The chart application starts with a random preload data, and shows the temperature trend in "realtime", new data arrives in every second. This seems to work properly without webassembly, but in the browser, the chart is not updated, only if i move the mouse. When the mouse is moved, then the chart displays all the received websocket updates, so probably only the screen/chart refresh is missing.

    The relevant part of the webassembly chart update is:

    void Chart::updateDateTimeAxis()
        //QDateTimeAxis *axis = static_cast<QDateTimeAxis *>(axisX());
        QDateTimeAxis *axis = static_cast<QDateTimeAxis *>(axes(Qt::Horizontal).back());
        if (m_Points.count() > 2) {
            QDateTime time = QDateTime::currentDateTime();
            qint64 msecs = static_cast<qint64>(;
            QDateTime startDateTime = 
    QDateTime::fromMSecsSinceEpoch(msecs,time.timeZone());//first datetime
            msecs = static_cast<qint64>( - 1).x());
            QDateTime endDateTime = 
    QDateTime::fromMSecsSinceEpoch(msecs,time.timeZone()); //last datetime
            qDebug() << "X axis range: " << startDateTime.toString(Qt::ISODate) << " - " << 

    Any idea what could be the problem?
    The Qt version is 5.14.1 and emscripten 1.38.30.

  • Hi, I'm having what looks like your same issue: Widgets are not being repainted until I move the mouse. It is working well in Desktop just as in your case. Note this is not a QChart or the like, it its just a few QWidgets. Ive got a small QT WebAssembly application. (Qt 5.14.2 WebAssembly and emscripten 1.38.27-64bit).

    If any other one is seeing the issue and/or found out what to do about it please enlighten us :).

    Perhaps there is some js instruction to force the repainting or something like that.

    I am using a QStackedWidget; I suspect this might be an issue with this specific widget.

Log in to reply