QCustomPlot Discussion and Comments

Sliding window to display a time varying signalReturn to overview

I am plotting multiple graphs of signals that are plotted against time on the xAxis. I want to restrict the visualisation to a sliding window along the X axis; for instance 'the last T seconds'. What's the most efficient way to do this? Do I have to iterate through all the graphs in the plot, find the max key value and call xAxis->setRange(max Key - T, maxKey)?

OK, I did it as follows, based on the documentation for signal rangeChanged. Is this the correct way?

In constructor for my PlotWidget

connect(qcustomplot->xAxis, SIGNAL(rangeChanged(QCPRange)), this, SLOT(setXRange(QCPRange)));

Where the slot is implemented as..

void PlotWidget::setXRange(QCPRange range)
{
  qcustomplot->xAxis->setRange(range.upper - 10, range.upper);
}