如何重置/删除qcustomplot的轴attick设置?

发布于 2025-02-12 06:30:21 字数 565 浏览 1 评论 0原文

我有一个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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不疑不惑不回忆 2025-02-19 06:30:23

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文