Programmatically reset zoom back to 100%

We have a chart with multiple chart lines that dynamically can be added and removed. This works well. 

Now, we enabled the zoom options and tested it with test users. Unfortunately, when zoomed in and added/removed other series they where not able to find the series as it is zoomed in somewhere. They all forget that they have zoomed in. What they expect is that when adding/removing a series that the chart zoom will automatically reset to 100%.

Is it possible to programmatically reset the zoom?

1 Reply

AB Akbar Basha K M Syncfusion Team May 1, 2018 06:02 AM UTC

Hi Mojado, 
Thanks for using Syncfusion product. We have analyzed your requirement and we like to inform you that, you can achieve this requirement using to set the `zoomPosition` and `zoomFactor` value to that axis. 
Find the below code snippet to achieve your requirement, 
Angular: 

addSeries() { 
          this.resetZoom(); 
          //…. 

removeSeries() { 
          this.resetZoom(); 
          //…. 

resetZoom() { 
          this.chart.primaryXAxis.zoomPosition = 0; 
          this.chart.primaryXAxis.zoomFactor = 1; 
          this.chart.primaryYAxis.zoomPosition = 0; 
          this.chart.primaryYAxis.zoomFactor = 1; 
          //…. 
  
We have prepared a sample based on this. Please find the sample from the below location, 

To run the sample please follow the below steps, 
  1. npm install
  2. npm start
Please let us know if you have any concern. 
Akbar Basha KM. 


Loader.
Up arrow icon