我有一组要绘制的点,它们的坐标存储在
中QVector<double> x(200), y(200);
我想用一些平滑的曲线连接它们,比如任何花键。或者结之间的更大点数也足够了。我的尝试是
customPlot->addGraph();
customPlot->graph(0)->setData(x, y);
customPlot->graph(0)->setPen(QPen(Qt::blue));
customPlot->xAxis->setLabel("Index");
customPlot->yAxis->setLabel("Amplitude");
customPlot->xAxis->setRange(0, 200);
customPlot->yAxis->setRange(-3, 3);
我尝试过QPainterPath类,但它没有用。请帮助我。
UPD:我现在正在查看QEasingCurve类,这些函数可能会有所帮助,但作者没有提供任何示例,我不知道如何使用它们。
答案 0 :(得分:1)
从代码中我会说你正在使用QtCharts。
您可以使用的QSplineSeries完全符合您的要求。