Following closely to the floorplan example, I have added a textblock to my node like this
myDiagram.nodeTemplate =
$$(go.Node, "Vertical",
{
locationObjectName: "SHAPE",
locationSpot: go.Spot.Center,
toolTip: tooltiptemplate,
selectionAdorned: false // use a Binding on the Shape.stroke to show selection
},
// remember the location of this Node
new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
// move a selected part into the Foreground layer, so it isn't obscured by any non-selected parts
new go.Binding("layerName", "isSelected", function (s) { return s ? "Foreground" : ""; }).ofObject(),
// can be resided according to the user's desires
{ resizable: true, resizeObjectName: "SHAPE" },
{ rotatable: true, rotateObjectName: "SHAPE" },
$$(go.Shape,
{
name: "SHAPE",
geometryString: "F1 M0 0 L20 0 20 20 0 20 z",
fill: "rgb(130, 130, 256)"
},
// this determines the actual shape of the Shape
new go.Binding("geometryString", "geo"),
// allows the color to be determined by the node data
new go.Binding("fill", "color"),
// selection causes the stroke to be blue instead of black
new go.Binding("stroke", "isSelected", function (s) { return s ? "dodgerblue" : "black"; }).ofObject(),
// remember the size of this node
new go.Binding("desiredSize", "size", go.Size.parse).makeTwoWay(go.Size.stringify),
// can set the angle of this Node
new go.Binding("angle", "angle").makeTwoWay()
),
$$(go.TextBlock,
{ editable: true, name: "LABEL" },
new go.Binding("text", "name"))
);
However, when I try to rotate, I get this error:
<span style="-sizing: border-; color: rgb255, 0, 0; font-family: Consolas, 'Lucida Console', monospace; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 12px; orphans: auto; text-align: left; text-indent: 0px; text-trans: none; white-space: pre-wrap; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; : rgb255, 255, 255;">Uncaught TypeError: Object #<HTMLDivElement> has no method 'startTransaction'</span><span style="color: rgb255, 0, 0; font-family: Consolas, 'Lucida Console', monospace; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 12px; orphans: auto; text-align: left; text-indent: 0px; text-trans: none; white-space: pre-wrap; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; : rgb255, 255, 255; display: inline !imant; : none;"> </span>