Hi everyone,

I have a plot, with two differents graph. The two graphs shares the same xAxis, but different yAxis ( first graph is with yAxis, second one with yAxis2). I want to have the same variations on both axis (especially when iRangeZoom or iRangeDrag interactions are enabled). So I implemented my own slot and have connected it to the rangeChanged(newRange, oldRange) signal of yAxis.

In my case, there is only 4 possiblities for a range to be changed : drag up, drag down, zoom in and zoom out (only mouse interactions).
I detect all the 4 cases but i can't handle the case zoom out.

For handling zoom in, i get the rangeZoomFactor vertical ( = 0.85) and i apply scaleRange function to my yAxis2 like this :

myPlot->yAxis2->scaleRange(myPlot->axisRect()->rangeZoomFactor(Qt::Vertical), myPlot->yAxis2->range().center());

I know if my rangeZoomFactor would be greater than 1.0, i would have my zoom Out case working and not my zoom in.

if rangeZoomFactor is less than 1.0 (default one is 0.85), we can clearly call it like "rangeZoomINFactor", how do i compute the "rangeZoomOUTFactor" in order the have the same range variations on both axis.

My first option was to compute it by saying it is the opposite of rangeZoomInFactor with respect to 1. Would have be 1.15 but DOESNT WORK ( when i wheel up then wheel down several times, range are completely distorted).

My second option was to compute it by saying : rangeZoomFactor = ( newRange.upper - newRange.lower) / (oldRange.upper - oldRange.lower) but still doesn't work.

I don't know what to do or what i am doing wrong. If you need more informations or you didn't understand exactly my problems, i would be pleased to help!

Thanks,
Julien

Julien