QCustomPlot Discussion and Comments

Validating realtime data plotting best practicesReturn to overview

So I have simple chart which plots real time data.Wanted to know the best practices for the same
Currently my questions are based on real time plotting of a line chart.

1. Is there any other way to update the user interface other than using replot -----'ui->chartPlot->replot();' . Replot cleans the palate and plots the whole data again,if there is any optimization which can be done here?
2. On re plotting data beyond the current axis ,the new axis have to be updated each time..I am calculating the highest and lowest point in my data and updating the axis each time.Is this the best approach? Or there are other approaches?
3. While the use has zoomed and pan ,if there is a re plot called with new data the user is taken out of the zoom and pan suddenly and the whole re plotted axis shows .This effect looks very shaky..is there any way to better it?
4. Does the performance matter if
i)new data added is absolutely different from the last plot
ii)new data is a superset of the last plotted data

1. replotting always requires a call to replot on either the plot or the layer. if you have multiple plots updating at different times, you can put them on different layers and call replot on them separately
2. rescaleAxis already calculates the bounds, but if you want to come up with a different way that is faster (such as only calculating whether the bounds are bigger when you get new data), you can reimplement one or more of QCPGraph::getKeyRange or QCPGraph::getValueRange.
3. i cant be much help here because we are on QCP 1.3. i implemented my own zoom feature, but i'm sure you can implement the same sort of functionality. on ours, we have a current size (the visible area) and a bounded size(the maximum allowed size). when we are zoomed in, we only change the bounded size, and dont change what they are looking at (unless they are looking at a section outside the new bounds). We calculate this using QRect::intersected.
4. depends on how you add your data. If you use addData, it is faster than calling setData. if you call setData on both, then it doesnt make any difference.