Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Chart not updating

Chart not updating

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 316 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    raketmus
    wrote on last edited by
    #1

    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

    jsulmJ 1 Reply Last reply
    0
    • R raketmus

      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

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

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

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • R Offline
        R Offline
        raketmus
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved