`const $ = go.GraphObject.make;
const myDiagram = $(go.Diagram, “myDiagramDiv”, {
layout: $(go.GridLayout),
“undoManager.isEnabled”: true,
});
myDiagram.nodeTemplate = $(
go.Node,
“Auto”,
$(go.Shape, “RoundedRectangle”, { fill: “lightblue” }),
$(go.TextBlock, { margin: 5 }, new go.Binding(“text”, “key”))
);
myDiagram.groupTemplate = $(
go.Group,
“Auto”,
{
layout: $(go.GridLayout, {
wrappingColumn: 2,
cellSize: new go.Size(150, 100),
}),
background: “lightyellow”,
},
$(go.Panel, “Vertical”,
$(go.TextBlock, { font: “bold 14px sans-serif”, margin: 5 }, new go.Binding(“text”, “key”)),
$(go.Placeholder, { padding: 10 })
)
);
myDiagram.linkTemplate = $(
go.Link,
{ routing: go.Link.Orthogonal, corner: 10 },
$(go.Shape, { strokeWidth: 2, stroke: “gray” }),
$(go.Shape, { toArrow: “Standard”, stroke: “gray”, fill: “gray” })
);
myDiagram.model = new go.GraphLinksModel(
[
{ key: “Group1”, isGroup: true },
{ key: "1", group: "Group1" },
{ key: "2", group: "Group1" },
{ key: "3", group: "Group1" },
{ key: "4", group: "Group1" },
{ key: "5", group: "Group1" },
{ key: "6", group: "Group1" },
{ key: "7", group: "Group1" },
{ key: "8", group: "Group1" },
{ key: "9", group: "Group1" },
{ key: "10", group: "Group1" },
],
[
{ from: “1”, to: “2” },
{ from: “2”, to: “3” },
{ from: “3”, to: “4” },
{ from: “4”, to: “5” },
{ from: “5”, to: “6” },
{ from: “6”, to: “7” },
{ from: “7”, to: “8” },
{ from: “8”, to: “9” },
{ from: “9”, to: “10” },
]
);
`
By using this code this output generated
But I want that as like that
Means I want to swap nodes in even row like shown in attached images
And handle this I want dynamic my data come as like that as provided in code But want to generate output as like this attached in second image