Articles in this section
Category / Section

How to Exclude Node from Layout and Position it in Javascript Diagram?

2 mins read

In Syncfusion® JavaScript Diagram, when arranging nodes using a layout algorithm, there might be situations where you want certain nodes to be positioned manually rather than being automatically arranged by the algorithm. To achieve this, you can set the excludeFromLayout property to true for the nodes you wish to position manually. This will prevent the layout algorithm from affecting their placement.

To get started, you need to define the created event in the diagram, then set the excludeFromLayout property to true for each node you want to position manually. Finally, specify the desired offset values for those nodes to control their exact placement.

created: () => {
  for (var i = 0; i < diagram.nodes.length; i++) {
    var node = diagram.nodes[i];
    if ((node.data).Name === 'Robert') {
      // Excludes node from layout
      node.excludeFromLayout = true;
      node.offsetX = 150;
      node.offsetY = 150;
    }
  }
} 

Conclusion

I hope you enjoyed learning how to exclude a node from a layout and position it in JavaScript Diagram.

You can refer to our JavaScript Diagram feature tour page to learn about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.

You can also explore our JavaScript 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