Thanks for the reply walter. I have tried three different ways to set fill color of the shape but its not working. Pls help me on below i have added code on myDiagram.linkTemplate .
click: function (e, link) {
e.diagram.clearHighlighteds();
if (link.fromNode) link.fromNode.isHighlighted = true;
if (link.toNode) link.toNode.isHighlighted = true;
e.diagram.commandHandler.scrollToPart(scrollToSource ? link.fromNode : link.toNode);
scrollToSource = !scrollToSource;
// Step 1 not working start //
var model = myDiagram.model;
myDiagram.startTransaction();
// Here I am passing the target node key value to change the color
var data = model.nodeDataArray[3];
var newcolor = “Black”;
model.setDataProperty(data, “fill”, newcolor);
model.setDataProperty(data, “color”, newcolor);myDiagram.commitTransaction(“changed shared color”);
// Step 1 not working end //
// Step 2 not working start //
var node = myDiagram.findNodeForKey(“3”);
var model = myDiagram.model;
model.startTransaction(“change color”);
model.setDataProperty(node.data, “fill”, “green”);
model.commitTransaction(“change color”);
// Step 2 not working end //
// Step 3 not working start //
myDiagram.startTransaction("change fill color");
var node = myDiagram.findNodeForKey("3");
var shape = node.findObject("PANEL");
shape.fill = "green";
myDiagram.commitTransaction("change fill color");
var node = myDiagram.findNodeForKey("2");
node.findLinksOutOf().each(function (link) {
link.findObject("SHAPE").stroke = "green";
});
// Step 3 not working end //
}
Or any other we can achieve this functionality ???
Currently i am working flowchart samples
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: “#005691”, strokeWidth: 2, cursor: “pointer” },
new go.Binding(“figure”, “figure”),
new go.Binding(“stroke”, “isHighlighted”, function (h) { return h ? “red” : “black”; }).ofObject(),
new go.Binding(“strokeWidth”, “isHighlighted”, function (h) { return h ? 4 : 1; }).ofObject()
),
$$(go.TextBlock, textStyle(),
{
margin: 8,
maxSize: new go.Size(160, NaN),
wrap: go.TextBlock.WrapFit,
editable: false,
cursor: "pointer"
},
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)
));
Please refer my shapes are inside in the panel.