myDiagram.nodeTemplateMap.add("", // the default category
$(go.Node, "Table", nodeStyle(),
// the main object is a Panel that surrounds a TextBlock with a rectangular Shape
$(go.Panel, "Auto",
$(go.Shape, "Rectangle",
{ fill: $(go.Brush, "Linear", { 0.0: "rgb(172,192,242)", 1.0: "rgb(124,134,221)" }), strokeWidth: 0, minSize: new go.Size(100, 80)},
new go.Binding("figure", "figure")),
$(go.Panel, "Horizontal",
$(go.Picture,
{ margin: 10, width: 50, height: 50, background: "red" },
new go.Binding("source")),
$(go.TextBlock, textStyle(),
{
margin: 8,
maxSize: new go.Size(160, NaN),
wrap: go.TextBlock.WrapFit,
editable: true
},
new go.Binding("text").makeTwoWay())
)
),
// four named ports, one on each side:
makePort("T", go.Spot.Top, go.Spot.TopSide, false, true),
makePort("L", go.Spot.Left, go.Spot.LeftSide, true, true),
makePort("R", go.Spot.Right, go.Spot.RightSide, true, true),
makePort("B", go.Spot.Bottom, go.Spot.BottomSide, true, false)
));`Preformatted text`
why error when add ‘source’ attribute to data?
{"text":"步骤", "key":-4, "loc":"-192 131", source:"cat1.png"}
go.js:1736 Uncaught TypeError: Cannot read property ‘class’ of null
at Function.Z.fromJSON.Z.fromJson (go.js:1736)
at load (flowchart.html:298)
at init (flowchart.html:275)
at onload (flowchart.html:322)