[英]How to reset/delete Qcustomplot's axis ticker setting?
我有一個 QcustomPlot 小部件,我想重用它來繪制各種 plot。 但是有一種情況,我需要將 xAxis 代碼設置為 DateTime。所以我這樣做了:
QSharedPointer<QCPAxisTickerDateTime> dateTicker(new QCPAxisTickerDateTime);
dateTicker->setDateTimeFormat("yyyy-MM-dd");
customplot->xAxis->setTicker(dateTicker);
它永遠改變了小部件 xAxis 代碼。 所以當我想把它切換到其他地塊時。 xAxis 在每個刻度上始終是 1970-01-01。 如何將軸標記設置重置為默認/正常數字設置?
我試過了:
customplot->clearPlottables();
customplot->xAxis->setRange(0,5);
customplot->replot;
但他們都沒有工作。 他們只清除了 plot 但沒有清除 xAixs 滴答聲。有什么建議嗎?
ui->customPlot->xAxis->setTicker(QSharedPointer(new QCPAxisTicker)); - 這將使它們恢復到標准 state
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.