I have a set of points to plot and their coordinates are stored in
QVector<double> x(200), y(200);
I'd like to connect them with some smooth curve, any, say, splines. Or a bigger array of points between knots would also suffice. My try is
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);
I tried using:
QPainterPath
class, but it didn't work.QEasingCurve
class, its functions might help, but there are no examples and I don't know how to use them.From the code I would say you are using Qt Charts.
There is a QSplineSeries you can use that does exactly what you want.