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. Image for the cookie policy date

Chart zoom x and y independently

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

1 Reply

PS Parthiban Sundaram Syncfusion Team 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.  
  
Regards,
Parthiban S
 
 


Loader.
Live Chat Icon For mobile
Up arrow icon