Just out of the curiosity…it seems that Node created via Model.addNodeData() sets the locationSpot to center. IMO it’s a bit confusing as Part.locationSpot states that the initial value should be Spot.TopLeft.

I’m quite new with GoJS, so maybe I’m missing something essential.


(GoJS v1.6.5)

The value of Node.locationSpot, as with any other GraphObject property, is determined by the template’s initialization. (Unless there is a Binding for that property.)

Maybe the new Node is being positioned by Diagram.layout, causing the bound location information to be discarded? If so, try setting Layout.isInitial and/or Layout.isOngoing to false.

Thanks for your reply!

No, this property is not bound. Furthermore I don’t think the locationSpot is discarded as the following code makes it position as expected.

drawingDiagram.model.addNodeData({ key: tagNodeKey, 
                                       category: "comment",
                                       text: "Example text.",
                                       group: groupNodeKey,
                                       loc: go.Point.stringify(tagLoc) 
drawingDiagram.model.addLinkData({"from":, "to": tagNodeKey});
drawingDiagram.model.setDataProperty(, "group", groupNodeKey);
// Some reason created node's initial location spot is at the center.
// We want it to be at top-left.
var newTag = drawingDiagram.findNodeForKey(tagNodeKey);
newTag.locationSpot = go.Spot.TopLeft;

I also debugged the locationSpot property value and it indeed wasn’t TopLeft.

Is there still a problem? If so, what is your node template?


Aaaah…sooo embarrasing! Found the origin of the issue from the node template! I was setting the very property there. Bummer!

For some reason my eye didn’t catch that one earlier. It might be some remnant from some random experiment etc.

Well…at least learning something new every day :-).

Sorry for wasting everybody’s time!

It’s OK, that’s why we’re here for you.