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
close icon

programmatically zoom and pan sfchart

Hy,

I want to zoom chart programmatically to a specific range of data, but I don't know what method to use.

What methods should I use for that?


Thank you,



5 Replies

PS Parthiban Sundaram Syncfusion Team September 29, 2017 11:46 AM UTC

Hi Alex,  
 
Thanks for using Syncfusion products.  
 
You can use the ZoomByRange method in the ChartZoomPanBehavior class to achieve your requirement. Please refer the following code snippet for more details.  
 
Code snippet:  
  
  
   zoomPan.ZoomByRange(yAxis, 50, 60); // Specify the range to zoom  
  
Please download the sample from following location.  
 
 
Please let us know, if you need further assistance on this.  
 
Regards  
Parthiban S  



AL Alex October 3, 2017 08:22 AM UTC

Hello,


Thank you for your answer. 

1. I want to zoom and pan on DateTimeAxis, how can I use the ZoomByRange method?

2. More important, how can I zoom to fit on  numerical axis(the vertical one).


Thank you



PS Parthiban Sundaram Syncfusion Team October 3, 2017 09:34 AM UTC

Hi Alex,  
  
Thanks for the update.  
  
You can achieve this requrimenet by passing start date and end date with DateTimeAxis in the ZoomByRange method of the ChartZoomPanBehavior. Please refer the following code snippet for more details.    
   
Code snippet:    
  
ZoomByRange in DateTimeAxis  
  
  
 double startDate = new DateTime(2017, 10, 5).ToOADate();  
 double endDate = new DateTime(2017, 10, 7).ToOADate();  
  
 zoomPan.ZoomByRange(xAxis,startDate,endDate); // Specify the range to zoom  
  
  
ZoomByRange in NumericalAxis  
  
    
   zoomPan.ZoomByRange(yAxis, 0, 2); // Specify the range to zoom    
  
  
We have prepared the sample based on your requirement. Please download the sample from following location.    
   
   
Please let us know, if you need further assistance on this.    
   
Regards    
Parthiban S    



AL Alex October 4, 2017 11:20 AM UTC

Hey,


Thank you



PS Parthiban Sundaram Syncfusion Team October 5, 2017 05:43 AM UTC

Hi Alex,

Thanks for the update. We are glad that the given solution has helped to achieve your requirement. Please let us know, if you need further assistance on this.

Regards,
Parthiban S

Loader.
Live Chat Icon For mobile
Up arrow icon