Articles in this section

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

This article explains how to exclude a node from the layout and position it in a React Diagram. In Syncfusion® React 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 < diagramInstance.nodes.length; i++) {
       var node = diagramInstance.nodes[i];
       if ((node.data).Name === 'Robert') {
           // Excludes node from layout
           node.excludeFromLayout = true;
           node.offsetX = 150;
           node.offsetY = 150;
       }
   }
}} 

Conclusion

We hope you enjoyed learning about how to exclude a node from the layout and position it in React Diagram.

You can refer to our React Diagram feature tour page to learn about its other groundbreaking feature representations and documentation, and how to quickly get started with configuration specifications. You can also explore our React 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!

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