Minimal GoJS Sample

This isn't a truly minimal demonstration of GoJS, because we do specify a custom Node template, but it's pretty simple. The whole source for the sample is shown below.

Using your mouse and common keyboard commands, you can pan, select, move, copy, delete, and undo/redo.

This sample sets the Diagram's Node template, which data-binds both the text string and the shape's fill color.

For an overview of building your own templates and model data, see the Getting Started tutorial.

The Diagram.initialContentAlignment setting causes the diagram's contents to appear in the center of the diagram's viewport.

On touch devices, hold your finger stationary to bring up a context menu. The default context menu supports most of the standard commands that are enabled at that time for that object.

For a more elaborate and capable sample, see the Basic sample.

For a sample that loads JSON data from the server, see the Minimal JSON sample.