如何重置/删除qcustomplot的轴attick设置?
我有一个qcustomplot小部件,我想重用它来绘制各种情节。但是有一种情况我需要将Xaxis ticker设置为DateTime。因此,我做到了:
QSharedPointer<QCPAxisTickerDateTime> dateTicker(new QCPAxisTickerDateTime);
dateTicker->setDateTimeFormat("yyyy-MM-dd");
customplot->xAxis->setTicker(dateTicker);
它永远改变了小部件Xaxis Ticker。因此,当我想将其切换到其他图时。 Xaxis始终是1970-01-01在每个tick上。如何将轴票房设置重置为默认情况/正常数字设置?
我很游来:
customplot->clearPlottables();
customplot->xAxis->setRange(0,5);
customplot->replot;
但是它们都没有工作。他们只清除了剧情,但没有Xaixs tick。是否有建议?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
uii-&gt; customplot-&gt; xaxis-&gt; setticker(qsharedPointer(QSSHARDPOINTER(QCPAXISTICKER))); - 这将使他们恢复其标准状态
ui->customPlot->xAxis->setTicker(QSharedPointer(new QCPAxisTicker)); - this will return them to their standard state