简体   繁体   English

D3:数据集更改时,强制布局链接上的滞后更新

[英]D3: Lag update on force layout links when dataset changes

The "data 15000" button changes the dataset to another one that has the same nodes, but more linkages between nodes. “数据15000”按钮将数据集更改为另一个具有相同节点但节点之间链接更多的数据集。 However, the user has to click twice in order to fully display the updated force layout. 但是,用户必须单击两次才能完全显示更新的力布局。

Why is this line of code 1-click late? 为什么这行代码会一键延迟?

link.enter().append("line")
    .attr("stroke-width", function (d) { return scale(d.value); });

How do I solve this problem? 我该如何解决这个问题? Thank you! 谢谢!

JSFiddle here JSFiddle 在这里

The problem, basically: 问题基本上是:

在此处输入图片说明

Please add selection to tick function: 请在勾选功能中添加选择:

function ticked() {
    var link = linkg.selectAll("line")
    var fnode = fnodeg.selectAll("circle")
    ... update attributes for link(line) and fnode(circle).

working code here 这里的工作代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM