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.
Unfortunately, activation email could not send to your email. Please try again.

Chart zoom x and y independently

Thread ID:

Created:

Updated:

Platform:

Replies:

132146 Aug 16,2017 11:37 AM Aug 18,2017 01:15 PM Xamarin.Android 1
loading
Tags: SfChart
Martin Dusek
Asked On August 16, 2017 11:37 AM

Hello,
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

Martin

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

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.  
  
Regards,
Parthiban S
 
 


CONFIRMATION

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.

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.

;