Android Shinobi zooming only the x axis or the y axis


#1

Hi All,

I have the code below. When i use finger to zoom the x axis, I want to zoom only the x axis. When i zoom y axis, i want to zoom the y axis only. Is there a function to lock the other axis while i zoom one axis?

xAxis.enableGesturePanning(true);

xAxis.enableGestureZooming(true);

yAxis.enableGesturePanning(true);

yAxis.enableGestureZooming(true);

Regards,

Victor


#2

Hi Victor,

Whenever you make a zoom gesture there will always be an amount of movement in the X direction and also in the Y direction (even though it may be a very small amount). Therefore, if both axes have zooming enabled then both will receive the instructions to zoom their displayed ranges.

I’m not exactly sure what you mean but if you wanted to only zoom on one axis depending which direction has the greatest movement in the zoom gesture, you may be able to make use of the ShinobiChart.OnGestureListener to detect zoom (or pinch) gestures and after doing some calculations requesting a range change on the applicable axis. This would mean you would have to effectively calculate the amount to zoom yourself.

Kind regards,

Patrick


#3

Hi Patrick,

Thank you for your reply. I will investigate the ShinobiChart.OnGestureListener to setup the range change in one axis only.

Regards,

Victor


#4

Hi Patrick,

There is another problem in Shinobi Android Premium 1.4.1 zooming. Looking at the screenshot below, i set the X axis range from Dec 31-Jan 21, and i have disabled out of range panning as below, but i can still zoom beyond my X axis range. This is a bug!!   It is NOT acceptable.

xAxis.allowPanningOutOfMaxRange(false);

xAxis.allowPanningOutOfDefaultRange(false);

Regards,

Victor


#5

Hello Victor,

Thanks for getting in touch.

Can I please ask, so you zoom out and you see the ‘padding’ (to the left and right) of the data; when you release your fingers does the chart bounce back to display the correct range? If this is the case and you do not wish to see this bouncing behaviour, you can disable it by calling the axis enableBouncingAtLimits(boolean bounceAtLimits) method with a false argument. 

May I also please ask, have you set a default range on your xAxis? If you do not set this, the axis will adopt a default range of the range of your data.

I hope that you find this information useful, if you have any further queries please do not hesitate to get in touch.

Thanks,

Kai.


#6

Hi Kai,

Yes, i have set a default range for the xAxis. Your solution is spot-on and works.

Thanks.

Victor