I would like to extend the previous graph with labels on links, I thought it would be better to continue on this topic rather than opening another one.
Following the ER Sample, I modified the linkTemplate adding the part the shows the same label on both link ends:
myDiagram.linkTemplate =
$(CustomLink, // defined below
{
routing: go.Link.AvoidsNodes,
corner: 4,
curve: go.Link.JumpGap
},
$(go.Shape, { stroke: "#2F4F4F", strokeWidth: 2 }),
$(go.TextBlock, // the "from" label
{
textAlign: "center",
font: "bold 12px sans-serif",
stroke: "#1967B3",
segmentIndex: 0,
segmentOffset: new go.Point(NaN, NaN),
segmentOrientation: go.Link.OrientUpright
},
new go.Binding("text", "label")),
$(go.TextBlock, // the "to" label
{
textAlign: "center",
font: "bold 12px sans-serif",
stroke: "#1967B3",
segmentIndex: -1,
segmentOffset: new go.Point(NaN, NaN),
segmentOrientation: go.Link.OrientUpright
},
new go.Binding("text", "label"))
);
The result is the following, which is fine regarding the labels, but input/output ports are not accordingly spaced.
Do you know if there is a way to accomplish this and make the labels easily readable?
An alternative solution could be to write labels inside nodes like in the Data Flow Sample, but this should be adapted to the right aligned ports, and I don’t know how to do that… :(
Any suggestion is appreciated,
Many thanks!