How to Show/Hide Annotations at Runtime in Angular Diagram?
In this article, you can learn how to show or hide annotations at runtime in an Angular Diagram. You can control the visibility of annotations by adjusting their visible property. The visible property of an annotation determines whether it is shown or hidden on the Angular Diagram.
To hide or show annotations at once, you need to loop through each node in the diagram and checks the annotations attached to those nodes.
Below is a code example demonstrating how to toggle the visibility of annotations with a button click:
handleannotation() {
let nodesCollection =(this.diagram as Diagram).nodes;
let visibility = this.showNodeAnnotations ? false : true;
nodesCollection.forEach(node => {
(node.annotations as ShapeAnnotationModel[]).forEach(annotation => {
annotation.visibility = visibility;
});
});
this.showNodeAnnotations = !this.showNodeAnnotations;
}
Conclusion
I hope you enjoyed about how to show/hide annotations at runtime in 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, BoldDesk Support, or feedback portal. We are always happy to assist you!