"数据15000"按钮将数据集更改为具有相同节点的另一个数据集,但节点之间的链接更多。但是,用户必须单击两次才能完全显示更新的力布局。
为什么这行代码点击一次?
link.enter().append("line")
.attr("stroke-width", function (d) { return scale(d.value); });
我该如何解决这个问题?谢谢!
JSFiddle here
问题,主要是:
答案 0 :(得分:2)
请在tick功能中添加选项:
function ticked() {
var link = linkg.selectAll("line")
var fnode = fnodeg.selectAll("circle")
... update attributes for link(line) and fnode(circle).
工作代码here