addNodeData adds on top of an existing node

Hi!
I’m using addNodeData to add a node to the diagram’s model. The node gets added to the diagram, however, it is added on top of an existing node. Is there a way to refresh the diagram that lays out the nodes properly? Or is there another way I should be adding nodes to the diagram?

Here’s an example of this: Edit fiddle - JSFiddle - Code Playground

Thanks!
Ishan

The default Diagram.layout just makes sure that each Node has a real location. It doesn’t try to be smart about arranging the nodes in any manner.

So you need to specify a value for Diagram.layout that would be appropriate for your app. Or you need to assign the Node.location yourself, either setting it directly or via data binding.

Thank you, Walter! I tried using GridLayout and now the nodes are added properly.