Hi Walter,
My requirement is textlable should be displayed at above the links as shown below:
In the above diagram, textlable is 12345678901234567890&12345678901234567890 which is displayed at above the links between two nodes.
Below code I am using for links and nodes display:
myDiagram.linkTemplate =
$(go.Link,
{
//fromEndSegmentLength: 20 ,
routing: go.Link.AvoidsNodes,
adjusting: go.Link.End,
//curve: go.Link.JumpGap,
corner: 5,
toShortLength: 4,
relinkableFrom: true,
relinkableTo: true,
reshapable: false,
resegmentable: true,
// isLayoutPositioned:true,
//segmentFraction: 0.5,
layerName: "Background"
},
$(go.Shape, { strokeWidth: 2 })
);
}
PathPatterns.add("DivorceCloseAndStrong", $(go.Shape,{geometryString: "M0 18 L1 18 M0 0 L0 0 M0 30 L1 33",fill: "transparent",stroke: "black",strokeWidth: 1,strokeCap: "square"}));
myDiagram.linkTemplateMap.add("DivorceLinkFormat",
$(go.Link, { selectable: false, routing: go.Link.AvoidsNodes,isLayoutPositioned:true },
$(go.Shape,
{ strokeWidth: 2 },
new go.Binding("stroke", "patt", function(f) { return (f === "") ? "black" : "transparent"; }),
new go.Binding("pathPattern", "patt", convertPathPatternToShape)),
$(go.Shape, {geometryString: "m 0,8 l 14,-8 m -2,8 l 14,-8", width: 20, height: 20, strokeWidth: 2, stroke: "black" }),
$(go.TextBlock, { margin: -2,alignment: go.Spot.Top,segmentOffset: new go.Point(0, -20)}, new go.Binding("text", "relationText")),
$(go.TextBlock, { margin: -2,alignment: go.Spot.Top,segmentOffset: new go.Point(0, -10)}, new go.Binding("text", "srelationText"))
));
if (relationCode == "divh") {
var remarks_dh = data.dh;
mdata = { from: key, to: relationNumber, labelKeys: [mlab.key], category: "DivorceLinkFormat",
relationText:remarks(relationText,relationNumber,remarks_dh,key),patt: "DivorceHostile",
toArrow: "Standard"
};
model.addLinkData(mdata);
DivorceCloseAndStrong code id ‘divh’.
{key: 0, name: "aaa",s:"FM",divh:1,age:"31",relationText:"1=12345678901234567890&12345678901234567890"},
{key: 1, name: "bbb",s:"F",age:"29",nodeRemarks:"222222222"},
If I will use divh:1 and relationText at key:1 as below :
{key: 0, name: "aaa",s:"FM",age:"31"},
{key: 1, name: "bbb",s:"F",divh:0,age:"29",nodeRemarks:"222222222",relationText:"0=12345678901234567890&12345678901234567890"},
then textlabel is displaying at below the link as shown as the below pic.
In the above pic, links are reversing. Hence textlabel is displaying at below the links.It should not happen. textlabel should be displayed at above the links between the nodes.
This is my requirement.Is it possible?
Please let me know if need more details.
Thanks,
Prameela.D