I am unable to create the zoom effect on the diagram

I am using diagram zoom method and
 initially I am passing the zoom level as 1, 
so for zoom in I am making the zoom level by 0.2
and for zoom out it will be decremented by 0.2

so this is causing improper misbehaviour in zoom of diagram

this.zoomLevel will be varying by 0.2

let diagramInstance;
      let diagramObj = document.getElementById("diagram");
      diagramInstance = diagramObj.ej2_instances[0];
      diagramInstance.zoom(this.zoomLevel);

1 Reply

AR Aravind Ravi Syncfusion Team May 29, 2020 06:57 AM UTC

Hi Sunil, 

By using the zoomTo public API method in the diagram we can able to perform zoom in / zoom out in the diagram. If you set zoom type as “ZoomIn” means then it is used to zoom in the diagram. If type is set as “ZoomOut ” means then it is used to Zoom out the diagram. Please find the below code snippet for how to use zoom in / zoom out the diagram. 

var diagram = this.$refs.diagram.ej2Instances; 
//zoomIn option is used to zoom in the diagram  
            let zoomin = { type: "ZoomIn", zoomFactor: 0.2 }; 
            diagram.zoomTo(zoomin); 

var diagram = this.$refs.diagram.ej2Instances; 
//ZoomOut option is used to zoom out the diagram  
            let zoomout = { type: "ZoomOut", zoomFactor: 0.2 }; 
            diagram.zoomTo(zoomout); 

We have already implement sample for zoom in our live demos. Please find the sample in below link 


We have attached a simple sample for your reference. Please find the sample in below link 


Regards 
Aravind Ravi 


Loader.
Up arrow icon