QwtPlotCurve 未显示在图表上
我目前正在开发一个项目,在该项目中我在图表上加载大量数据点(大约 50,000 个,因此我可以根据需要放大)。
我想测试这些命令是如何工作的,所以我想我应该用 10 条数据来尝试代码,但不幸的是我的曲线拒绝显示在我的图表上。
QwtPlot *leftGraph;
leftGraph = new QwtPlot;
leftGraph->setCanvasBackground(Qt::white);
leftGraph->setMaximumHeight(200);
leftGraph->setAxisScale(0, 0.0, 20.0, 2.0);
leftGraph->setAxisScale(2, 0.0, 20.0, 2.0);
和
QwtPlotCurve *curve = new QwtPlotCurve();
curve->setStyle(QwtPlotCurve::Lines);
curve->setCurveAttribute(QwtPlotCurve::Fitted, true);
const double x[] = {0, 1, 2, 4, 5, 8, 10, 13, 14, 19};
const double y[] = {17, 16.5, 8, 3, 5, 7.5, 9, 10, 12, 14};
curve->setSamples(x, y, 10);
curve->attach(leftGraph);
有什么想法吗?非常感谢。
I'm currently working on a project in which I load a huge number of data points on a graph (something like 50,000, so I can zoom in as much as I want).
I wanted to test how the commands worked, so I thought I'd try out the code with 10 pieces of data, but unfortunately my curve refuses to show up on my graph.
QwtPlot *leftGraph;
leftGraph = new QwtPlot;
leftGraph->setCanvasBackground(Qt::white);
leftGraph->setMaximumHeight(200);
leftGraph->setAxisScale(0, 0.0, 20.0, 2.0);
leftGraph->setAxisScale(2, 0.0, 20.0, 2.0);
and
QwtPlotCurve *curve = new QwtPlotCurve();
curve->setStyle(QwtPlotCurve::Lines);
curve->setCurveAttribute(QwtPlotCurve::Fitted, true);
const double x[] = {0, 1, 2, 4, 5, 8, 10, 13, 14, 19};
const double y[] = {17, 16.5, 8, 3, 5, 7.5, 9, 10, 12, 14};
curve->setSamples(x, y, 10);
curve->attach(leftGraph);
Any ideas? Many thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试调用
leftGraph->replot()
让曲线出现。Try calling
leftGraph->replot()
to make the curve appear.