D3.js force directed graph, each group different color?
I've made a force directed graph with d3.js plugin, and I wanna color the nodes and the labels with the different color according to group which they belong. I've added scale for color: var color = d3.scale.category20(); and to node variable I've added: .style("fill", function(d) { return color(d.group); }) but all nodes are in the same color.. Here is my current situation: http://jsfiddle.net/WBkw9/ full script: var links = [ {source: "John", target: "Mike", group: "5"}, {source: "John", target: "Janice", group: "5"}, {source: "John", target: "Caleb", group: "5"}, {source: "John", target: