简体   繁体   中英

How to reset/delete Qcustomplot's axis ticker setting?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM