Ell*_*Zhu 5 d3.js force-layout
我很难在力图上定位文字标签.它们彼此重叠,我无法弄清楚如何解决它.我在网上尝试了很多解决方案,但没有一个能够很好地运行.你能帮我看一下吗?
以下是我的文字标签的代码:
var node_text = node_textNew.append("svg:text")
.attr("class", "text_note")
.attr("dx", 0)
.attr("dy", -0.5)
.attr('background-color', '#fff')
.attr("x", function(d, i) { return circleWidth + 5; })
.attr("y", function(d, i) { if (i>0) { return circleWidth + 0 } else { return 8 } })
.text(function(d) { return d.name});
Run Code Online (Sandbox Code Playgroud)
非常感谢你的帮助!