Is it possible to create link text on hierarchical diagrams, because I’m not explicitly creating the links… ? Here is my code:
var $ = go.GraphObject.make;
var myDiagram =
$(go.Diagram, this._element.nativeElement,
{
initialContentAlignment: go.Spot.TopCenter, // center Diagram contents,
"isReadOnly": true,
"undoManager.isEnabled": true, // enable Ctrl-Z to undo and Ctrl-Y to redo
layout: $(go.TreeLayout, // specify a Diagram.layout that arranges trees
{ angle: 90, layerSpacing: 35 })
});
// the template we defined earlier
myDiagram.nodeTemplate =
$(go.Node, go.Panel.Auto,
$(go.Shape, "Hexagon",
{ fill: "lightgrey" , angle: 90},
new go.Binding("figure", "fig"),
new go.Binding("fill","color")
),
$(go.TextBlock,
{ margin: 15, },
new go.Binding("text", "name"))
);
// define a Link template that routes orthogonally, with no arrowhead
myDiagram.linkTemplate =
$(go.Link,
{ routing: go.Link.Orthogonal, corner: 5 },
$(go.Shape, { strokeWidth: 3, stroke: "#555" }),
$(go.TextBlock,
{
textAlign: "center",
font: "14pt helvetica, arial, sans-serif",
stroke: "#555555",
margin: 4
},
new go.Binding("text","text"))
); // the link shape
var model = $(go.TreeModel);
model.nodeDataArray =
[
{ key: "1", name: this.cpm.decisions[0].label, fig: "Hexagon", color: "lightgrey",text:"link text here" },
{ key: "2", name: this.cpm.decisions[1].label, parent: "1", fig: "Hexagon", color: "lightgrey" },
{ key: "3", name: this.cpm.decisions[2].label, parent: "1", fig: "Hexagon", color: "lightgrey" },
{ key: "4", parent: "3", name: "TODO", fig: "Hexagon", color: "lightgrey" },
{ key: "5", parent: "3", name: "TODO", fig: "Hexagon", color: "lightgrey" },
{ key: "6", parent: "2", name: "TODO", fig: "Hexagon", color: "lightgrey" }
];
myDiagram.model = model;