I am trying to export the canvas to a png image.
From the docs , I found out we have to use makeImage() function.
It is not rendering the images present in the nodes of the diagram.
here are the screenshots of the canvas and the generated image:
Canvas:
This is the generated image:
The code for the nodeTemplate is:
yDiagram.nodeTemplateMap.add("product", goObj(go.Node, "Spot",nodeStyle(), goObj(go.Picture, { maxSize: new go.Size(50, 40) }, new go.Binding("source", "img")), makePort("T", go.Spot.Top, false, true), makePort("L", go.Spot.Left, true, true), makePort("R", go.Spot.Right, true, true), makePort("B", go.Spot.Bottom, true, false) ));
The code which exports the image is:
var button = document.getElementById('openSVG'); button.addEventListener('click', function() { var newWindow = window.open("","newWindow"); if (!newWindow) return; var newDocument = newWindow.document; var svg = myDiagram.makeImage({ scale: 1 }); newDocument.body.appendChild(svg); }, false);
The input data for the model is of the following form:
{ key: "A",img:"img/cloud.png", group: "Site 1",category: "product" },
I am able to generate the svg successfully but encountering this issue to generate the image.Am I missing something?
Thanks.