Unsolved QChart Update & Hold x, y-axis
-
Hi, I'm getting a lot of help through the community!
The first question is, I want to update the data coming into the timer in real time.void QTemperatureChart::UpdateChart(QPointF point) { m_pScatSeries->append(QPointF(point.x(), point.y() * 20.52415496)); m_pUpperSeries->append(QPointF(point.x(), point.y() * 20.52415496)); m_pLowerSeries->append(QPointF(point.x(), 0)); m_pAreaSeries = new QAreaSeries(m_pUpperSeries, m_pLowerSeries); //m_pAreaSeries->setName(name + QString::number(nameIndex)); m_pAreaSeries->setColor(QColor(1, 40, 64)); m_pChart->addSeries(m_pAreaSeries); m_pChart->addSeries(m_pScatSeries); this->update(); }
This is how it works, but it's weird.
And it doesn't matter if you create a series and recycle the variables you created, right? I set it as a global variable because I thought it would affect memory if it was generated with new every update.The second question is can you fix the axis of x, y and update only the chart? Right now, it's stuck at zero, so I can't see the chart out of range. Even if I update it, I want to keep the latest chart in the middle.