I think Lars is right. Based on the last answer of the link he provided, I added this code to one of my strength graphs, and it worked perfectly:
var path = svg.append("g").selectAll(".link") .data(force.links()) .enter().append("path") .attr("id",function(d,i) { return "linkId_" + i; }) ... var labelText = svg.selectAll(".labelText") .data(force.links()) .enter().append("text") .attr("class","labelText") .attr("dx",20) .attr("dy",0) .style("fill","red") .append("textPath") .attr("xlink:href",function(d,i) { return "#linkId_" + i;}) .text(function(d,i) { return "text for link " + i;});
FernOfTheAndes
source share