This is my code :
legend = svg.append("g")
.data(json.links)
.attr("class","legend")
.attr("transform","translate(50,30)")
.attr("data-legend", function(d){ return d.relation; })
.style("fill", function (d) { return color(d.group); })
.call(d3.legend);
It's work but only one relation appears in the lengend. Can you help me ? Thanks a lot !