I am using a LinkTemplate to display my diagram. I want to change the link color depending on a parameter bound from the model as follows
var myDiagram = $(go.Diagram, containerId, {
initialAutoScale: go.Diagram.UniformToFill,
initialContentAlignment: go.Spot.TopLeft,
layout: $(go.TreeLayout)
});
myDiagram.linkTemplate = $(go.Link, {
}, $(go.Shape, {strokeWidth: 2}, new go.Binding("stroke", "defaultColor", function(a){
a == true ? return "#00B5CB": return "#F47321";
}))
);
And the model is as follows
var nodeDataArray = [
{ key: "Alpha", defaultColor: true},
{ key: "Beta", defaultColor: false}
];
myDiagram.model = new go.GraphLinksModel(nodeDataArray, linkDataArray);
It’s not working and i don’t know why.Thanks for the help!