Perform zoom out of diagram programmatically

How to perform zoom out of diagram programmatically using some of the methods of properties of the diagram? I would appreciate some sample of the code.

Best regards,
Jiway 

1 Reply

SG Shyam G Syncfusion Team January 21, 2020 06:05 AM UTC

Hi Jiway, 

Please use the diagram zoomTo method to perform zoomIn and zoomOut operations programmatically. We have created a sample in which we have performed zoomIn and zoomOut operations at button click. Please refer to a code example and the sample below. 

Code example: 
function ZoomIn() { 
    let zoomOptions = { 
      type: "ZoomIn", 
      //Sets the factor by which we can zoom in or zoom out 
      zoomFactor: 0.5 
   
    //zoomin the diagram 
    diagramInstance.zoomTo(zoomOptions) 

function ZoomOut() { 
    let zoomOptions = { 
      type: "ZoomOut", 
      //Sets the factor by which we can zoom in or zoom out 
      zoomFactor: 0.5 
   
    //zoomout the diagram 
    diagramInstance.zoomTo(zoomOptions) 

}  



Regards, 
Shyam G 


Loader.
Up arrow icon