On Click...

Do Default
Create ______ Node
Create ______ Link

A system dynamics diagram shows the storages (stocks) and flows of material in some system, and the factors that influence the rates of flow. It is usually a cosmetic interface for building mathematical models -- you provide values and equations for the stocks and flows, and appropriate software can then simulate the system's behavior.

The diagram has two types of link: flow links and influence links. In additon to the node attached to each flow, there are 3 types of node:

  • stocks, the amount of some substance
  • clouds, like stocks, but outside the system of interest
  • variables, either numeric constants or calculated from other elements

The conventional user interface for building system dynamics diagrams is modal -- you select a tool in the toolbar, then either click in an empty part of the diagram to add a node or drag from one node to another to add a link. That is the approach used in this example, accomplished with the clickCreatingTool and linkingTool. Note that you need to click on the Pointer tool to revert to the normal mode.

In addition to the above, the diagram also installs the NodeLabelDraggingTool extension into ToolManager.mouseMoveTools.

This sample is based on a prototype developed by Robert Muetzelfeldt.

Diagram Model saved in JSON format:

GoJS Features in this sample

Tools

Tools handle all input events, such as mouse and keyboard interactions, in a Diagram. There are many kinds of predefined Tool classes that implement all of the common operations that users do.

For flexibility and simplicity, all input events are canonicalized as InputEvents and redirected by the diagram to go to the Diagram.currentTool. By default the Diagram.currentTool is an instance of ToolManager held as the Diagram.toolManager. The ToolManager implements support for all mode-less tools. The ToolManager is responsible for finding another tool that is ready to run and then making it the new current tool. This causes the new tool to process all of the input events (mouse, keyboard, and touch) until the tool decides that it is finished, at which time the diagram's current tool reverts back to the Diagram.defaultTool, which is normally the ToolManager, again.

More information can be found in the GoJS Intro.

Related samples