I am developing an application where very large measurement data (on the order of millions of data points) must be plotted as a scatter chart. I also want to implement an additional functionality. There will be a play button and when the user clicks this button, the data points will be dynamically added to the chart. (As groups of 10000 points.) So, the user will be able to see how the data set changes over the course of time. I am using the QtCharts libraries.

Some important points:
1) All data points are available before drawing the chart.
2) First, the minimum and maximum values of the data points for both coordinates is determined. The ranges of the axes are set to these values.
3) The x coordinate values of the data points are monotonically increasing. (The x coordinate denotes the time.)
From 2 and 3, we can see that when new data points are added to the chart, 1) the axes do not need to be rescaled, 2) the points that are currently available on the chart will not move.

I have prepared the data set, such that the points are divided into groups of 10000, with each group being added to a different scatter series. I have set the color of the scatter series the same, so they look as if they were the same series. In each iteration of the loop, the next scatter series is added to the chart and the repaint() method of chart view is invoked.
Qt Code:
  1. for (i = 0; i < groupCount; i++) {
  2. chart->addSeries(scatterSeries.at(i));
  3. chart->setAxisX(axisX, scatterSeries.at(i));
  4. chart->setAxisY(axisY, scatterSeries.at(i));
  5. chartView->repaint();
  6. QCoreApplication::processEvents();
  7. }
To copy to clipboard, switch view to plain text mode 

The replay of the data begins really fast, but then becomes very slow. I have figured out that this is because when the chart view's repaint() method is invoked, all the attached scatter series are painted once again. However, it would be enough if only the scatter series that has been attached most recently was painted. I'm still trying to figure out how to do this. I tried re-implementing the paintEvent() of the QChartView object, however that has nothing to do with the painting of the scatter series. It is just for painting the background of the chart. So at the moment, I'm just stuck.
Any help will be greatly appreciated. Thanks in advance.
Onat