I have a QCustomPlot widget with multiple graphs to display multiple streams of data on the same plot. My UI has checkboxes that correspond to each graph. When one is clicked, I show or hide that graph as such:
I continue adding and removing data regardless of whether or not the graph is visible so that it can be seamlessly toggled on/off.
widget->graph(0)->removeDataBefore(x - MAXWIDTH);
widget->xAxis->setRange(x - MAXWIDTH, x);
The problem I'm trying to solve is with rescaling the y-axis. yAxis->rescale() rescales for ALL the data, including the graphs that may not be visible. I want the yAxis-rescale() to scale for ONLY the visible graph data.
So, if graph(0) & graph(1) are set to false (not visible) and graph(2) & graph(3) are set to true (visible), the widget's yAxis is scaled for graph(2) & graph(3) but NOT graph(0) and graph(1).
Performance is a concern since I'm processing a fairly large real-time data set. What's the optimal way to do this?