How to get the node's offset values after layout get arranged in Angular Diagram?
Angular Diagram provides support to auto-arrange the nodes in the diagram area that is referred to as Layout. Refer this
documentation to know more about layout . It includes the following layout modes such as:
- Hierarchical layout
- Organization chart
- Radial tree
- Symmetric layout
- Mind Map layout
- Complex hierarchical tree layout
We can retrieve the values of the offsetX and offsetY properties of the nodes from the diagram’s nodes collection after the layout has been arranged in the diagram. In the below sample, upon clicking the button, we iterate through the nodes collection, retrieve the offsetX and offsetY values of each node, and print them in the console. For more information, please refer to the code snippet and sample link below:
app.component.html
<input type="button" value="get-offset-Value" (click)="getOffset()" />
app.component.ts
public getOffset() {
for (let i = 0; i < this.diagram.nodes.length; i++) {
console.log(
'Node' + (i + 1) + ':' + 'OffsetX->' + this.diagram.nodes[i].offsetX
);
console.log(
'Node' + (i + 1) + ':' + 'offsetY->' + this.diagram.nodes[i].offsetY
);
}
}
Conclusion
I hope you enjoyed learning about how to get the node’s offset values after layout get arranged 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, Direct-Trac, or feedback portal. We are always happy to assist you!