gpt4 book ai didi

d3.js - D3 强制布局文本标签重叠

转载 作者:行者123 更新时间:2023-12-04 20:36:49 31 4
gpt4 key购买 nike

我很难在力图上定位文本标签。它们相互重叠,我不知道如何修复它。我从网上尝试了很多解决方案,但没有一个效果很好。你能帮我看看吗?

这是我的文本标签的代码:

    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});

这是它现在的样子: enter image description here

非常感谢你的帮助!

最佳答案

试试这个 http://bl.ocks.org/MoritzStefaner/1377729 .
这里作者介绍了一种使用另一种力布局将标签放置在节点附近的方法。

关于d3.js - D3 强制布局文本标签重叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33615789/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com