We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Chart zoom x and y independently

Thread ID:





132146 Aug 16,2017 03:37 PM UTC Aug 18,2017 05:15 PM UTC Xamarin.Android 1
Tags: SfChart
Martin Dusek
Asked On August 16, 2017 03:37 PM UTC

I want to zoom x and y axis of the chart independently in Xamarin.Android chart. I.e. when I swipe 0 degree only x axis is zoomed, when I swipe 45 degree x and y axis are zoomed equally, when I swipe 90 degree only y axis is zoomed, etc.

If not, is it possible to switch between ZoomModeX (swiping 0 up to 45 degree) and ZoomModeY (swiping 45 degree up to 90 degree)?

Thank you


Parthiban Sundaram [Syncfusion]
Replied On August 18, 2017 05:15 PM UTC

Hi Martin, 
Thanks for the Syncfusion products. 
We have achieved this requirement by using the SetOnTouchListener method of SfChart. Please find the sample and code snippet from following location. 
Code Snippet: 
 public bool OnTouch(View v, MotionEvent e) 
            if (e.PointerCount == 2) 
                int pointer1Index = e.FindPointerIndex(0); 
                int pointer2Index = e.FindPointerIndex(1); 
                float x1 = e.GetX(pointer1Index); 
                float y1 = e.GetY(pointer1Index); 
                float x2 = e.GetX(pointer2Index); 
                float y2 = e.GetY(pointer2Index); 
                if (Math.Abs(x1 - x2) > Math.Abs(y1 - y2)) 
                    zoomPan.ZoomMode = ZoomMode.X; 
                else if (Math.Abs(y1 - y2) > Math.Abs(x1 - x2)) 
                    zoomPan.ZoomMode = ZoomMode.Y; 
            return base.OnTouchEvent(e); 
Please let us know, if you need further assistance on this.  
Parthiban S


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon