Change position of node

Hey there. I am fairly new to GoJS.

How can I change the position of an item in myDiagram.model.nodeDataArray?

Thank you for the time.

What do you mean by “position of an item in myDiagram.model.nodeDataArray”?

Do you mean that you want to change the order of the data objects in that Array? The order of data in the Model.nodeDataArray does not really matter, although it might have an effect, depending on the layout, when the model is loaded.

I would like to change the coordinates of a node in nodeDataArray.

GoJS Models do not have any inherent knowledge about the location or size or any visual attributes of any Nodes. Many diagrams automatically assign node locations using some predefined or custom Layout, so the node location does not need to be stored on the node data object in the model.

If your app wants to have node locations stored in the model data, then you need to have a Binding of Node.location (or Node.position) to the data property that you are using.

If you want the model to be automatically updated when something, such as the user dragging a node, changes the location of a node, then you should make that Binding a TwoWay binding.

Please read GoJS Data Binding -- Northwoods Software. There are lots of examples there and in lots of the samples.

I highly recommend that you read Get Started with GoJS and then all of the pages of the Introduction that talk about topics that matter to your app, starting at GoJS Introduction -- Northwoods Software.