Qt World Summit: Register Today!

qlineseries with multiple data points

  • I have a qlineseries with 7 million data points.

              QtCharts::QChart *chart = new QtCharts::QChart();
              chart->setTitle("Simple line chart example");
              QtCharts::QChartView *chartView = new QtCharts::QChartView(chart);

    The main window is very slow to respond. I am trying to resize the mainwindow and it keeps saying not responding.
    How can i make it so that the window stays reponsive, even just clicking on the window makes the program freeze for a few seconds before i can do anything.

  • @rafael
    The answer is: since you don't want to plot 7 million data points on the screen (right?), you want to thin out how many you create....

  • @rafael

    There is no way / reason to display 7 million data points at the same time in a lineseries on the screen.

    Use zoom features or down-sampling strategies to reduce the amout of samples plotted at a time.

  • I had a test program in python and i was using matplotlib to plot the data.
    i guess matplotlib does some downsampling in the background, because the plots are responsive.

    I was just using the same technique here.
    load all the data points, and plot.

    do you know of a library that does this, downsample and upsample data?

    void ConvertToLineSeries(std::vector<Pressure> data, QtCharts::QLineSeries *series)
        int count = 0;
        for(auto &p : data)
            if(count == (32 * 10))
                count = 0;
        qDebug() << series->points()[0];

    seems to be better , i'm only displaying data every 320 samples which reduced it to 21,875.

Log in to reply