Recreating collapsible force layout using d3 v4

喜欢而已 提交于 2019-12-01 20:49:23

I forgot to merge old nodes after enter().

link = svg.selectAll(".link").data(links, function(d) { return d.target.id; })
var linkEnter = link.enter().append("line").attr("class", "link");
link = linkEnter.merge(link);

Thanks to Mike Bostock for helping me with this problem. I thought there was an issue with d3 v4, turns out I didn't read changes fully :|

Refer this for more info: https://github.com/d3/d3-force/issues/37

Fixed fiddle: https://jsfiddle.net/t4vzg650/6/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!