2

I am referring this example: http://plnkr.co/edit/4xPx05PxnWxoQBhIj2lo?p=preview

enter image description here

The node colors here are dependent upon an additional column in data. The data is:

source,target,value,nodeColorTarget
DistA,Place1,1,blue
DistA,Place1,3,red
DistB,Place1,12,blue
DistB,Place2,2,grey
DistB,Place2,1,grey
DistB,Place3,2,blue

Now, I kind of need that I should be able to set some color to the node DistB. Currently, the color that is mentioned in the last occurrence of DistB is the color set to DistB. Can I not set some color to DistB without affecting it's target node, which here is Place3? Thanks!

VividD
  • 10,456
  • 6
  • 64
  • 111
d33a
  • 690
  • 1
  • 14
  • 39
  • 1
    check the place where the rectangle is appended change the fill function to return the color as per your algorithm. `node.append("rect") .attr("height", function(d) { return d.dy; }) .attr("width", sankey.nodeWidth()) .style("fill", function(d) {/*YOUR ALGO*/})` something like this http://plnkr.co/edit/S9rEgUsd2XMSRtXyxhMb?p=preview – Cyril Cherian Jul 04 '16 at 06:54

0 Answers0