score:4

Accepted answer

You can just add the attribute fill to change the color:

node.append("circle")
      .attr("r", function(d) { return d.r; })
      .style("fill", function(d){ return d.color; });

In the example above, suppose your data contains a color field.


Related Query