Moving nodes sequentially?

I managed to achieve what I wanted…
I’m still having a problem with positioning…
My code:


 recalculateNodesPositionAndProps = (nodesArray) => {
        this.diagram.nodes.each(node => {
             const layout =;
                // Group position
                // TBD : set the position without timeout.
                if (layout.position) {
                    const position = layout.position(node.diagram, node);
                    setTimeout(() => {
                        node.move(new go.Point(position.x, position.y));
                    }, 1000);

If I’m removing the timeout the groups are not positioned correctly!
Is there a way to know when one node finished moving to call the move function on the next node?
Or maybe the other way around, make a node move wait until the previous move is done?

This seems like a completely different topic, so I have given it a new forum topic.

Are you looking to animate the movement of nodes one-at-a-time? Right now you will have to implement that yourself. But we are working on adding more animation possibilities in version 2.1.

No. Without animations. Just set the position of specific nodes programmatically. I saw that when I updated the position without the timeout the nodes were not positioned correctly. That’s why I added the timeout.
Is there another way to set the position of a group of nodes at the same time programmatically?

Do you have a Diagram.layout? If so, that should be responsible for positioning all of the nodes.

If not, it is customary to have the node template(s) bind the Node.location or Node.position property so that they each get their intended location.

It’s odd to expect all of the nodes to be laid out (with or without a Diagram.layout) and then intentionally move everything again in an “InitialLayoutCompleted” DiagramEvent listener.

The reason I’m doing it this way and not binding the location is because I need to position the nodes according to the bounds of the diagram. The documentBounds get a value only after the diagram is drawn.
If there is a better solution for this I would be glad to know :)

I do not understand what you really want to do. The Diagram.documentBounds is determined entirely by the area occupied by the Nodes and Links.

Are you trying to take the size of the viewport into account when doing the layout? Any layout can consider it.