This sample demonstrates a data flow or workflow graph with labeled ports on nodes. A real application would provide the ability to edit the details (properties) of each node so that the actual database operation could be executed.

The ports of each node are set up as panels, created within the makePort function. This function sets various properties of the Shape and TextBlock that make up the panel, and properties of the panel itself. Most notable are GraphObject.portId to declare the shape as a port, and GraphObject.fromLinkable and GraphObject.toLinkable to set the way the ports can be linked.

The diagram also uses the makeTemplate function to create the node templates with shared features. This function takes a type, an image, a background color, and arrays of ports to create the node to be added to the Diagram.nodeTemplateMap.

For the same data model rendered somewhat differently, see the Data Flow (vertical) sample.

Diagram Model saved in JSON format:

GoJS Features in this sample

Table Panels

The "Table" Panel, Panel.Table, arranges objects in rows and columns. Each object in a Table Panel is put into the cell indexed by the value of GraphObject.row and GraphObject.column. The panel will look at the rows and columns for all of the objects in the panel to determine how many rows and columns the table should have. More information can be found in the GoJS Intro.

Related samples

Layered Digraph Layout

This predefined layout is used for placing Nodes of a general directed graph in layers (rows or columns). This is more general than TreeLayout, as it does not require that the graph be tree-structured. More information can be found in the GoJS Intro.

Related samples

Ports in Nodes

Specific elements of a Node at which links may connect are called ports. There may be any number of ports in a node. By default there is just one port, the whole node, which results in the effect of having the whole node act as the port. Port-like GraphObjects can only be in Nodes or Groups, not in Links or Adornments or simple Parts.

More information can be found in the GoJS Intro.

Related samples