var linkTemplate =
$$(go.Link, // the whole link panel
{
selectable: true,
resizeObjectName: 'SHAPE',
selectionAdornmentTemplate: linkSelectionAdornmentTemplate,
resizeAdornmentTemplate: linkSelectionAdornmentTemplate,
relinkableFrom: true,
relinkableTo: true,
reshapable: true,
routing: go.Link.AvoidsNodes,
resegmentable: true,
curve: go.Link.None,
corner: 10,
smoothness: 1
},
new go.Binding('zOrder', 'zOrder').makeTwoWay(),
new go.Binding('layerName', 'layerName').makeTwoWay(),
new go.Binding('points', 'points').makeTwoWay(),
new go.Binding('location', 'loc', go.Point.parse),
new go.Binding('position', 'pos', go.Point.parse),
new go.Binding('desiredSize', 'size', go.Size.parse).makeTwoWay(go.Size.stringify),
new go.Binding('selectable', 'selectable'),
new go.Binding('reshapable', 'reshapable'),
new go.Binding('visible', 'visible'),
$$(go.Shape, {
isPanelMain: true, stroke: "black", strokeWidth: 11
},
new go.Binding('strokeWidth', 'width', calculateLinkWidth1),
new go.Binding('stroke', 'color', calculateLinkGradient1)//.makeTwoWay(),
),
$$(go.Shape, {
isPanelMain: true, stroke: "#5e5e5e", strokeWidth: 9
},
new go.Binding('strokeWidth', 'width', calculateLinkWidth2),
new go.Binding('stroke', 'color', calculateLinkGradient2)//.makeTwoWay(),
),
$$(go.Shape, {
isPanelMain: true, stroke: "#8c8c8c", strokeWidth: 7
},
new go.Binding('strokeWidth', 'width', calculateLinkWidth3),
new go.Binding('stroke', 'color', calculateLinkGradient3)//.makeTwoWay(),
),
$$(go.Shape, {
isPanelMain: true, stroke: "#b2b2b2", strokeWidth: 5
},
new go.Binding('strokeWidth', 'width', calculateLinkWidth4),
new go.Binding('stroke', 'color', calculateLinkGradient4)//.makeTwoWay(),
),
$$(go.Shape,
{
isPanelMain: true,
name: 'SHAPE',
fill: 'lightblue',
stroke: '#99ccff',
strokeWidth: 3,
},
new go.Binding('desiredSize', 'size', go.Size.parse).makeTwoWay(go.Size.stringify),
new go.Binding('geometryString', 'geo').makeTwoWay(),
new go.Binding('strokeWidth', 'width'),//.makeTwoWay(),
new go.Binding('stroke', 'color'), //.makeTwoWay(),
new go.Binding('geometryString', 'angle', SetGeometryStringFromAngle).makeTwoWay(SetAngleFromGeometryString),
new go.Binding('strokeDashArray', 'strokeDashArray')
),
// Set the arrows to default to Standard. The "toArrow/fromArrow" attribute set to
// empty string makes the arrow to not show. The fromArrow will always have the
// word Backward in the name (i.e. Triangle, BackwardTriangle, etc.). Standard is
// the exception.
$$( go.Shape,
{ name: 'TOARROW', toArrow: '', fill: null, scale: 2, stroke: '#000' }, new go.Binding( 'toArrow' ), new go.Binding( 'fill', 'toArrowFill' ), new go.Binding( 'scale', 'toArrowScale' ), new go.Binding( 'stroke', 'toArrowStroke' ) ),
$$( go.Shape,
{ name: 'FROMARROW', fromArrow: '', fill: null, scale: 2, stroke: '#000' }, new go.Binding( 'fromArrow' ), new go.Binding( 'fill', 'fromArrowFill' ), new go.Binding( 'scale', 'fromArrowScale' ), new go.Binding( 'stroke', 'fromArrowStroke' ) )
);
return linkTemplate;
}
The shapes of increasing width give the link a gradient effect. (They represent pipes).