Add port to selected nodes:

Double-click in the diagram background in order to add a new node there. In this sample you can add ports to a selected node by clicking the above buttons or by using the context menu. Draw links between ports by dragging between ports. If you select a link you can relink or reshape it. Right-click or touch-hold on a port to bring up a context menu that allows you to remove it or change its color.

The diagram also uses a custom link to allow for special routing to help parallel links avoid each other using overridden Link.computeEndSegmentLength, Link.hasCurviness, and Link.computeCurviness functions.

See the Ports Intro page for an explanation of GoJS ports.

Diagram Model saved in JSON format:
{ "class": "go.GraphLinksModel", "copiesArrays": true, "copiesArrayObjects": true, "linkFromPortIdProperty": "fromPort", "linkToPortIdProperty": "toPort", "nodeDataArray": [ {"key":1, "name":"Unit One", "loc":"101 204", "leftArray":[ {"portColor":"#fae3d7", "portId":"left0"} ], "topArray":[ {"portColor":"#d6effc", "portId":"top0"} ], "bottomArray":[ {"portColor":"#ebe3fc", "portId":"bottom0"} ], "rightArray":[ {"portColor":"#eaeef8", "portId":"right0"},{"portColor":"#fadfe5", "portId":"right1"} ] }, {"key":2, "name":"Unit Two", "loc":"320 152", "leftArray":[ {"portColor":"#6cafdb", "portId":"left0"},{"portColor":"#66d6d1", "portId":"left1"},{"portColor":"#fae3d7", "portId":"left2"} ], "topArray":[ {"portColor":"#d6effc", "portId":"top0"} ], "bottomArray":[ {"portColor":"#eaeef8", "portId":"bottom0"},{"portColor":"#eaeef8", "portId":"bottom1"},{"portColor":"#6cafdb", "portId":"bottom2"} ], "rightArray":[ ] }, {"key":3, "name":"Unit Three", "loc":"384 319", "leftArray":[ {"portColor":"#66d6d1", "portId":"left0"},{"portColor":"#fadfe5", "portId":"left1"},{"portColor":"#6cafdb", "portId":"left2"} ], "topArray":[ {"portColor":"#66d6d1", "portId":"top0"} ], "bottomArray":[ {"portColor":"#6cafdb", "portId":"bottom0"} ], "rightArray":[ ] }, {"key":4, "name":"Unit Four", "loc":"138 351", "leftArray":[ {"portColor":"#fae3d7", "portId":"left0"} ], "topArray":[ {"portColor":"#6cafdb", "portId":"top0"} ], "bottomArray":[ {"portColor":"#6cafdb", "portId":"bottom0"} ], "rightArray":[ {"portColor":"#6cafdb", "portId":"right0"},{"portColor":"#66d6d1", "portId":"right1"} ] } ], "linkDataArray": [ {"from":4, "to":2, "fromPort":"top0", "toPort":"bottom0"}, {"from":4, "to":2, "fromPort":"top0", "toPort":"bottom0"}, {"from":3, "to":2, "fromPort":"top0", "toPort":"bottom1"}, {"from":4, "to":3, "fromPort":"right0", "toPort":"left0"}, {"from":4, "to":3, "fromPort":"right1", "toPort":"left2"}, {"from":1, "to":2, "fromPort":"right0", "toPort":"left1"}, {"from":1, "to":2, "fromPort":"right1", "toPort":"left2"} ]}