在d3.js中折叠/展开树的子节点? [英] Collapse/expand child nodes of tree in d3.js?

查看:340
本文介绍了在d3.js中折叠/展开树的子节点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个树状结构(或者在我自己的json中修改一个我自己的数据集),我试图创建一些功能:

I'm building a tree structure (or rather modifying one of the examples with a set of my own data in my own json) and I'm trying to create some functionality:

我的树的布局是从树的示例:
http ://mbostock.github.com/d3/ex/cluster.html

My tree's layout is that from the tree example: http://mbostock.github.com/d3/ex/cluster.html

我向圈子添加了一个我想要的onclick事件折叠被点击节点的子节点。也就是说,当用户点击与节点相关联的钢蓝色圆圈时,我希望节点的子节点消失。

I am adding (to the circles) an onclick event which I would like to collapse the children of the clicked node. That is to say, when a user clicks the steelblue circle associated with a node, I want that nodes children to disappear.

我已经清理了文档,

我可以做什么?

推荐答案

有这样:

http://mbostock.github.com/d3/talk/20111018/tree.html

还有一些其他交互式分层我的 SVG开放主题演讲中的布局示例。

There are a number of other interactive hierarchical layout examples from my SVG Open keynote.

这篇关于在d3.js中折叠/展开树的子节点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆