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

Chart not updating



  • I have a qchart

       chart = new QChart();
       series->append(QDateTime::currentDateTime().toMSecsSinceEpoch(), 20.00);
       series->append(QDateTime::currentDateTime().toMSecsSinceEpoch() + 900, 25.00);
       chart->addSeries(series);
       chart->setTitle("Tempature since 0:00");
       axisX = new QDateTimeAxis;
       axisX->setTickCount(10);
       axisX->setFormat("hh:mm:ss");
       axisX->setTitleText("Time");
       chart->addAxis(axisX, Qt::AlignBottom);
       series->attachAxis(axisX);
    
       axisY = new QValueAxis;
       axisY->setLabelFormat("%i");
       axisY->setTitleText("Tempature");
       chart->addAxis(axisY, Qt::AlignLeft);
       series->attachAxis(axisY);
       chartView = new QChartView(chart);
       chartView->setRenderHint(QPainter::Antialiasing);
    

    which i want to update in a timeout fuction for a timer the thing is it is not updating after appending series i can make it update the chart it self by removeing and adding the series but this does not update the axis how do i do this


  • Qt Champions 2019

    @raketmus I don't see any timers in the code you posted. How do you update in the timeout slot?



  • I have figured out my problem i was not updating min and max values for the axises.
    The documentation should really include this in every example seeing how hard this was to find out.


Log in to reply