I am playing around with QCharts (using area chart example as a template).
I am drawing an area chart with 10000 points in each of the series, and am finding that it is very slow, 30s for the window to appear and resizing the window results in the process hanging, its unusable for this dataset . Any ideas what could be wrong here ? I have seen that disabling anti aliasing might help, however it doesn't.
I have the folllowing code
#include <QtWidgets/QApplication>
#include <QtWidgets/QMainWindow>
#include <QtCharts/QChartView>
#include <QtCharts/QLineSeries>
#include <QtCharts/QAreaSeries>
#include <QRandomGenerator>
#include <QDateTime>
#include <QtCharts/QHXYModelMapper>
#include <QTimer>
#include "boost/range/irange.hpp"
QT_CHARTS_USE_NAMESPACE
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
auto *upper = new QLineSeries;
auto *lower = new QLineSeries;
auto *generator = QRandomGenerator::global();
const auto maxSamples = 10000;
for(auto x : boost::irange(0, maxSamples))
{
lower->append(QPointF(x, 0));
upper->append(QPointF(x, generator->bounded(0, 100)));
}
auto *series = new QAreaSeries(upper, lower);
QChart *chart = new QChart();
chart->addSeries(series);
chart->createDefaultAxes();
chart->legend()->setVisible(false);
chart->axisY(series)->setRange(0, 100);
QChartView *chartView = new QChartView(chart);
//chartView->setRenderHint(QPainter::Antialiasing);
QMainWindow window;
window.setCentralWidget(chartView);
window.resize(800, 600);
window.show();
return a.exec();
}
Any ideas what could be the problem here?