QCustomPlot Discussion and Comments

Pinning plot while zoomingReturn to overview

So I want to be able to zoom a spectrogram in the vertical direction. Got that working... but I would like to keep a particular value (0) fixed at the bottom of the plot. If I hold the cursor there while moving the scroll wheel, it works pretty well... but is there an easy way of programmatically setting it so that the zoom always keeps a particular value fixed?

You should reimplement your own function setRange.

void AbstractCustomPlot::setRange(QCPRange range){

    for(int i=0; i<this->axisRects().size(); i++ ){
        if(range.lower<0)
            this->axisRect(i)->axis(QCPAxis::atBottom)->setRange (0,range.upper);
        else
            this->axisRect(i)->axis(QCPAxis::atBottom)->setRange(range);
    }

}

This is an example where I use a inherited QCustomPlot. With this function, it's impossible to zoom or drag values below 0 (since there is no negative time)