I have the following node template:
myDiagram.nodeTemplate =
$$(go.Node, go.Panel.Vertical, // the whole node panel
new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
$$(go.Panel, go.Panel.Spot,
$$(go.Panel, go.Panel.Auto,
$$(go.Shape,
{ name: "backgroundLayer", strokeWidth: 4, stroke: null, fill: null, portId: "" },
//new go.Binding("stroke", "status", partStatusReflection)),
new go.Binding("stroke", "status", setStatusDisplay)),
$$(go.Picture,
{ desiredSize: new go.Size(24, 24), margin: 3 },
new go.Binding("source", "imageUrl"))))
);
and this is my link template
myDiagram.linkTemplate =
$(go.Link, go.Link.AvoidsNodes,
{ corner: 3 },
$(go.Shape,
{ strokeWidth: 2 })
);
This is how my JSON object looks like:
{ “class”: “go.GraphLinksModel”,
“nodeDataArray”: [
{“key”:“CTR:35”, “type”:“Controller”, “devicename”:“ACU-L1-02”, “deviceid”:“35”, “imageUrl”:“http://localhost:52230//Images/controller.png”, “defaultImage”:“controller.png”, “loc”:“440 247”},
{“key”:“CTR:38”, “type”:“Controller”, “devicename”:“ACU-B1-01”, “deviceid”:“38”, “imageUrl”:“http://localhost:52230//Images/controller.png”, “defaultImage”:“controller.png”, “loc”:“619 141”},
{“key”:“RDR:1833”, “type”:“Reader”, “devicename”:“ACU-L1-02-R1”, “deviceid”:“1833”, “imageUrl”:“http://localhost:52230//Images/reader.png”, “defaultImage”:“reader.png”, “loc”:“600 338”},
{“key”:“RDR:1834”, “type”:“Reader”, “devicename”:“ACU-L1-02-R2”, “deviceid”:“1834”, “imageUrl”:“http://localhost:52230//Images/reader.png”, “defaultImage”:“reader.png”, “loc”:“209 88”}
],
“linkDataArray”: [ {“from”:“CTR:35”, “to”:“RDR:1833”} ]}
I get the above error in Chrome’s javascript debugger when I run this page.
However, everything turns out fine once I remove this chunk of code:
myDiagram.linkTemplate =
$(go.Link, go.Link.AvoidsNodes,
{ corner: 3 },
$(go.Shape,
{ strokeWidth: 2 })
);