I have a QcustomPlot widget that I want to reuse it for plotting all kinds of plot. But there is a case that I need to set the xAxis ticker to DateTime.So I did this:
QSharedPointer<QCPAxisTickerDateTime> dateTicker(new QCPAxisTickerDateTime);
dateTicker->setDateTimeFormat("yyyy-MM-dd");
customplot->xAxis->setTicker(dateTicker);
It changed the widget xAxis ticker forever. So when I want to switch it to other plots. The xAxis will always be 1970-01-01 on every tick. How do I reset the axis ticker setting to default/normal number setting?
I've tride:
customplot->clearPlottables();
customplot->xAxis->setRange(0,5);
customplot->replot;
but none of them worked. They only cleared the plot but not the xAixs ticks.Any suggestions?
ui->customPlot->xAxis->setTicker(QSharedPointer(new QCPAxisTicker)); - this will return them to their standard state