I think mpFXYVector is the way to go.
The simplest way to handle this would be to write a wrapper class for mpFXYVector, which contains the FIFO buffer of the last data points. Each time a new datapoint arrives, add it to the FIFO buffer, which will display the oldest point, then load mpFXYVector with the updated buffer. The wxMathPlot mpWindow class will keep track of the rest of what you need.
A more elegant approach would be the specialization of mpFXYVector, which implements the FIFO buffer using simple vectors in mpFXYVector. The advantage of this is that you keep only one copy of the displayed data. If you don’t show many thousands of points, I doubt that the advantage is worth the extra problems with inheriting from mpFXYVector, and not just using the documented mpFXYVector interface.
After viewing the details, the only difficult bit is to replace mpFXYVector :: SetData () with the new Add () method to add data points as they arrive. The new method is to manage the mpFXYVector vectors as FIFO buffers and reimplement the code to update the bounding box (which, unfortunately, was not written with inheritance).
As a result, specialization provides a solution with less memory and more flexibility than using a wrapper.
source share