Articles in this section
Category / Section

How to calculate zoom level in % when zoom in/out the Angular Diagram?

1 min read

In the Angular Diagram, you can calculate the zoom in and zoom out values using the zoomTo method. The zoomTo() method scales the diagram control by a specified factor. It accepts arguments such as zoomFactor, focusPoint, and type. Here’s what each argument does:

zoomFactor: Determines the degree of zooming, allowing you to zoom in or zoom out by a specified amount.
focusPoint: Specifies the point on the diagram page that should be centered after zooming. This can be useful for highlighting specific areas of the diagram.
type: Specifies whether to zoom in or zoom out.

let zoomin: ZoomOptions = { type: 'ZoomIn', zoomFactor: 0.2 };
this.diagram.zoomTo(zoomin);

To calculate the zoom value, you can access the currentZoom property in the scrollSettings, which gets updated based on zoom-in and zoom-out actions. If you wish to represent the zoom value as a percentage, you can multiply the currentZoom value by 100. This will give you the zoom level in percentage.

 public zoomContent() {
   return Math.round(this.diagram.scrollSettings.currentZoom * 100) + ' %';
 }

Sample

Conclusion

I hope you enjoyed learning about how to calculate zoom level in % when zoom in/out the Angular Diagram.

You can refer to our Angular Diagram feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our Angular Diagram example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied