Can item array be a 2 dimentional array ?
JavaScript does not support 2-D arrays, but you can certainly use an Array of Arrays and nested Panels with itemTemplates:
myDiagram.nodeTemplate =
$(go.Node, "Vertical",
$(go.TextBlock, { font: "bold 12pt sans-serif" },
new go.Binding("text")
),
$(go.Panel, "Auto",
$(go.Shape,
new go.Binding("fill", "color")),
$(go.Panel, "Table",
new go.Binding("itemArray", "array"),
{
itemTemplate:
$(go.Panel, "TableRow",
new go.Binding("itemArray", ""),
{
itemTemplate:
$(go.Panel,
new go.Binding("column", "itemIndex").ofObject(),
$(go.TextBlock, { margin: 2, width: 20, height: 20, textAlign: "center", verticalAlignment: go.Spot.Center },
new go.Binding("text", ""))
)
}
)
}
)
)
);
Then with:
myDiagram.model = new go.GraphLinksModel(
[
{
key: 4, text: "Delta", color: "pink",
array: [
[0, 1, 2, 3],
[1, 3, 5, 7],
[2, 5, 8, 11]
]
}
]);
you get: