I want to plotting some large chunk of data (3k) which is coming every 100ms. I tried QCustomPlot and Qwt with exact 3k points and i got really good performances in plotting with Qwt and really bad performances with QCustomPlot. And i think i behave wrongly with QCustomPlot, i used this code for plotting in QCustomPlot (This example is from QCustomPlot plot-examples which i edited function setupQuadraticDemo
):
void MainWindow::setupQuadraticDemo(QCustomPlot *customPlot)
{
demoName = "Quadratic Demo";
customPlot->addGraph();
customPlot->setNotAntialiasedElements(QCP::AntialiasedElement::aeAll);
customPlot->xAxis->setRange(0, 1000);
customPlot->yAxis->setRange(0, 1000);
customPlot->xAxis->setLabel("x");
customPlot->yAxis->setLabel("y");
connect(&dataTimer, &QTimer::timeout, this, [customPlot]
{
constexpr auto length = 3000;
QVector<double> x(length), y(length);
std::srand(std::time(nullptr));
for (int i = 0; i < length; ++i)
{
x[i] = std::rand() % 1000;
y[i] = std::rand() % 1000;
}
customPlot->graph(0)->setData(x, y, true);
customPlot->replot();
});
dataTimer.start(100);
}
And this code for Qwt. Is i do wrong with QCustomPlot ? Why it's too slow in plotting ?