I am using QtCharts .
I need both axes to be rescaled after adding the values. The values ββI added are not between 0 and 1, and also not since 1970.

The constructor code for my dialog is as follows:
m_series = new QLineSeries; m_series->setName(name); auto chart = new QChart; chart->legend()->setVisible(false); chart->addSeries(m_series); m_axisX = new QDateTimeAxis; //m_axisX->setFormat("HH:mm:ss"); m_axisX->setTitleText(tr("Zeitpunkt")); chart->addAxis(m_axisX, Qt::AlignBottom); m_series->attachAxis(m_axisX); auto axisY = new QValueAxis; axisY->setTitleText(unit); chart->addAxis(axisY, Qt::AlignLeft); m_series->attachAxis(axisY); auto chartView = new QChartView(chart, this); chartView->setRenderHint(QPainter::Antialiasing);
My MainWindow emits signals containing new values. Several open chart dialogs are connected to this signal.
void ChartDialog::liveUpdate(const RealTimeMeasureRegisters ®isters) { auto result = ((®isters)->*m_methodPtr)(); m_series->append(registers.timestamp(), result); }
Is there any easy way to tell QDateTimeAxis (in my case m_axisX ) to automatically adapt to the new values?
QDateTimeAxis :: setRange () does not look very good, because I need to set the minimum and maximum.
source share