Hi,
I would like to update the graph link template before exporting the graph as a JPG file.
I saw that using a transaction I can set a whole new linkTemplate to the diagram simply using this, do you agree?
myDiagram.startTransaction("update_template");
var oldTemplate = myDiagram.linkTemplate;
myDiagram.linkTemplate = $(go.Link, ...);
myDiagram.makeImage();
myDiagram.linkTemplate = oldTemplate;
myDiagram.commitTransaction("update_template");
But in my case, I need to change only one property of the template (i.e. the line width) and I do not know how to directly access the strokeWidth property of the "Link ==> Shape"
structure and set it to a fixed value (i.e. one pixel).
This is my linkTemplate (getLinkColor()
, getLinkWidth()
and getLinkLabel()
are not included for brevity):
myDiagram.linkTemplate = $(go.Link,
{ selectable: false },
$(go.Shape,
new go.Binding("stroke", "cabletype", getLinkColor),
new go.Binding("strokeWidth", "cabletype", getLinkWidth)
),
$(go.Panel, "Auto",
$(go.TextBlock,
{
textAlign: "center",
font: "13pt helvetica, arial, sans-serif",
stroke: "black",
margin: 4
},
new go.Binding("text", "", getLinkLabel)
)
)
);
Is it possible to do that?
Thanks,
Guido