Articles in this section

How to Update the ViewPort at Runtime in Angular Diagram?

In this article, you can learn how to update the viewport at runtime in Angular Diagram. You can use the updateViewport() method to dynamically adjust the dimensions of the diagram’s viewport. While loading a saved Angular Diagram, updateViewport() ensures that the viewport correctly aligns with the loaded content, potentially fitting the entire diagram within view. Once the diagram is loaded, it will adjust the viewport size, ensuring the correct rendering of the diagram.

The below code snippet demonstrating how to update the viewport at runtime:

loadDiagram(event: ProgressEvent<FileReader>) {
   const jsonString = event.target?.result as string;
   this.diagram.loadDiagram(jsonString);
   //Updates diagram viewport
   this.diagram.updateViewPort();
 } 

Sample

Conclusion

We hope you enjoyed learning about how to update the viewport at runtime in Angular Diagram.

You can refer to our Angular Diagram feature tour page to learn about its other groundbreaking feature representations and documentation, as well as how to quickly get started with 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 explore 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, BoldDesk Support, 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)
Access denied
Access denied