I have a basic diagram that is using a TreeLayout, and I need to add a group box around some nodes. Is it possible to do that?
Right now when I define the groupTemplate it moves the parent node but it does not draw the box around the other nodes.
Here is the my current code I have. I get a Tree view how I want, but the Group is all the way up to the left side and there is no box around the rest of the nodes.
let myDiagram = $(go.Diagram, "nodesList",
{
initialDocumentSpot: go.Spot.TopCenter,
initialViewportSpot: go.Spot.TopCenter,
layout:
$(go.TreeLayout,
{
arrangement: go.TreeLayout.ArrangementVertical,
angle: 90
}
)
});
myDiagram.nodeTemplate = $(go.Node, "Auto", {
locationSpot: go.Spot.Center
}, $(go.Shape, "RoundedRectangle", {
fill: "white",
portId: "",
cursor: "pointer",
fromLinkable: true, fromLinkableSelfNode: true, fromLinkableDuplicates: true,
toLinkable: true, toLinkableSelfNode: true, toLinkableDuplicates: true
},
new go.Binding("fill", "color")),
new go.Binding("figure"),
$(go.TextBlock, {
font: "bold 14px sans-serif",
stroke: "#333",
margin: 6,
isMultiline: true,
editable: false
},
new go.Binding("text", "text")));
// GROUP
myDiagram.groupTemplate = $(go.Group, "Vertical",
{
selectionObjectName: "PANEL",
ungroupable: false,
},
$(go.TextBlock,
{
font: "bold 15px sans-serif",
editable: false
},
new go.Binding("text", "text").makeTwoWay(),
new go.Binding("stroke", "color")
),
$(go.Panel, "Auto",
{
name: "PANEL",
},
$(go.Shape, "Rectangle",
{
fill: null,
stroke: "gray",
strokeWidth: 3,
portId: "",
cursor: "pointer",
fromLinkable: true, fromLinkableSelfNode: true, fromLinkableDuplicates: true,
toLinkable: true, toLinkableSelfNode: true, toLinkableDuplicates: true
}
),
$(go.Placeholder, { margin: 10, background: "transparent" })
)
);
myDiagram.linkTemplate =
$(go.Link, {
routing: go.Link.Orthogonal,
corner: 0
},
$(go.Shape, { strokeWidth: 2, stroke: "white" })
);
myDiagram.model = new go.TreeModel(this.assetsObject);