Sure. Let’s assume you want to save the panel type on the node data as a property with a string value, say “H” for go.Panel.Horizontal and “V” for go.Panel.Vertical. So define two functions:
function parseType(s) {
if (s === "H") return go.Panel.Horizontal;
return go.Panel.Vertical;
}
function stringifyType(t) {
if (t === go.Panel.Horizontal) return "H";
return "V";
}
Here’s a node template:
myDiagram.nodeTemplate =
$(go.Node, "Vertical",
new go.Binding("type", "type", parseType).makeTwoWay(stringifyType),
$(go.Shape, { fill: "white" },
new go.Binding("height"),
new go.Binding("width"),
new go.Binding("fill", "color")),
$(go.TextBlock,
new go.Binding("text").makeTwoWay())
);
Then you could toggle the direction of each panel by modifying each of the model data: