Multiple yAxis problem


Hey everyone,

I have a problem with the multiple yAxes. I have two yAxes, one for the right side and one for the left side. The both yAxes have the same range (3 -20) and the same values assigned to the properties. If I scroll down below the y-values 0, the left Axis has the correct range and the right Axis range (3,4,5,6,…, 20 axis has the wrong range (0,1,2,3,4,…,20). If i scroll up to the y-values 20 and higher, the both axes values are correct again.


Hi kupferdaechle,

You will need to enable panning and zooming on your new axis

secondAxis.enableGesturePanning = YES;
secondAxis.enableMomentumPanning = YES;
secondAxis.enableMomentumZooming = YES;
secondAxis.enableGestureZooming = YES;

This will allow your axis to respond to any of the same gestures that your primary axis responds to. If they are both initialised to the same range, then they will keep in sync.


Unfortunately this doesn’t work for me. I tried this before i wrote here in the forum.

The problem with the async axes only appears if the minimum property from the range is higher than 0.


Hmm… we aren’t able to reproduce that problem at our end. Would you mind sending a sample project in to so we can better diagnose the issue?


Thanks for sending that in! We’ve had a look, and found what looks to be the smoking gun. In sChartDidFinishLoadingData, calling NSLog(@"%@", [chart allYAxes]); printed the following;

    "SChartNumberAxis at 0x14ddfcc0, axisRange = { 3.000000, 15.000000 }, defaultRange = { 3.000000, 15.000000 }, maxRange = { -0.999923, 15.000000 }",
    "SChartNumberAxis at 0x14de2620, axisRange = { 3.000000, 15.000000 }, defaultRange = { 3.000000, 15.000000 }, maxRange = { -0.500000, 15.000000 }"

It looks like the maxRange of the second axis was not getting properly adjusted.

I’ll try and come up with a better solution, but for now, setting “allowPanningOutOfMaxRange = YES” on both axes will keep them in sync. Alternatively, “allowPanningOutOfDefaultRange = NO” will have the same effect, but with tighter limitations.