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.

Is it possible to programmatically reset the zoom?

Thread ID:

Created:

Updated:

Platform:

Replies:

124874 Jul 5,2016 04:30 PM Aug 7,2018 07:56 AM Xamarin.Forms 5
loading
Tags: SfChart
Philippe Bourque
Asked On July 5, 2016 04:30 PM

When I clear the data in my SFChart, the zoom become active and really zoom in (I don't why???).

Is it possible to reset the zoom programmatically?

This will help me to put the scope in a real fresh state after clearing the datas.

Thanks,

Phil

Yuvaraj Palanisamy [Syncfusion]
Replied On July 6, 2016 08:14 AM

Hi Philippe Bourque,  
  
Thanks for contacting Syncfusion Support.  
  
Yes, you can use the following code example to reset the zoom in while clearing the data.  
  
Code Example [ C#]  
   
ChartZoomPanBehavior zoom = new ChartZoomPanBehavior();  
zoom.Reset();  
   
  
Thanks,  
Yuvaraj  


Philippe Bourque
Replied On July 6, 2016 09:45 AM

Thank you Yuvaraj, it works! 

Phil

Yuvaraj Palanisamy [Syncfusion]
Replied On July 7, 2016 02:00 AM

Hi Phil,

Thanks for your update.

Thanks,
Yuvaraj
  


Sarthak Jagetia
Replied On August 6, 2018 12:56 PM

Hi,
If I remove the button functionality in the sample provided and add the zoompan behaviour in OnCreate function, the chart does not automatically zoom in. 
How to achieve this?

Michael Prabhu M [Syncfusion]
Replied On August 7, 2018 07:56 AM

Hi Sarthak Jagetia, 
 
Greetings from Syncfusion, we have analyzed your sample and we like to explain the behavior of ZoomByRange method, this method has 3 parameters, axis and its range min and max, calling this method during initializing the chart is not recommended because chart will not be rendered and there will not be any axis with range assigned to it. So, the right way to use this method is when the chart is completely rendered and there is an axis to alter its range, you can achieve this requirement by using ActualRangeChanged event in ChartAxis class. Please refer below code snippet.  
 
Code snippet [C#]:    
  
private bool isLoadTime = true; 
xAxis.ActualRangeChanged += XAxis_ActualRangeChanged; 
  
private void XAxis_ActualRangeChanged(object sender, ChartAxis.ActualRangeChangedEventArgs e) 
{ 
      if (isLoadTime) 
      { 
           zoomPan.ZoomByRange(xAxis, enddate.AddSeconds(-1000), enddate); 
      } 
  
      isLoadTime = false; 
} 
 
We have also modified the sample and it can be downloaded from the link below. 
Sample: 211972 
Thanks, 
Michael 




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.

;