Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

Changing the link color based on the attribute from the node

$
0
0

@UmaRajaram wrote:

Hi

We have the attribute in the Node as “isNew”. I would like to change the color of the link based on both the connecting nodes. Eg: if the fromNode or the toNode has the data as “isNew” the color should be green if not it should be black. I have added the binding of Stroke to the toNode. How i can change the color for the drawing link based on the attribute in the Node.

diagram.linkTemplate =
(go.Link... (go.Shape, // the link shape
{ strokeWidth: 1.5 },
new go.Binding(“stroke”, “toNode”, function(n) {

          return n.data.linkColor; 
        }).ofObject() 
   ),
  
   $(go.Shape,  // the arrowhead
    {  toArrow: "standard", stroke: null },
         new go.Binding("fill", "toNode", function(n) { return n.data.linkColor; })
         .ofObject(),    
    )

);

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles