GOJS negative node location


at the moment we’re evaluating GOJS for our company. I’ve set up a diagram and added two nodes (fiddle). I would have expected the following output:

It seems as if GOJS doesn’t draw correctly. Is there any configuration property that enables this support?

I don’t know how you have set up your diagram nor what result you got that is not what you expected.

But I suspect that the size of your viewport, the HTML DIV element, is large enough to show both nodes, so the diagram is automatically scrolled to show everything. You can confirm this by looking at the value of Diagram.position.

This is similar to how a browser will not scroll a short HTML page up so that its first lines are clipped off the top when there is room to show the whole document in the window.

Read more at http://gojs.net/latest/intro/viewport.html and http://gojs.net/latest/intro/initialView.html.

Another way to explain it is: what would you expect to see if there were only a single node and its location (Node.location) in document coordinates were (2345, 6789)?

I think most people would prefer to see the node rather than show the empty area at the origin.

You could use a scrollMode of InfiniteScroll and initialPosition if you really want that:

var myDiagram = $(go.Diagram, 'gojs',
    	'undoManager.isEnabled': true,
      scrollMode: go.Diagram.InfiniteScroll,
      initialPosition: new go.Point(-10, -10) // to account for diagram.padding


See: http://gojs.net/latest/samples/scrollModes.html