d3树 - 父母有相同的孩子 [英] d3 tree - parents having same children

查看:165
本文介绍了d3树 - 父母有相同的孩子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将我的代码从JIT转换到D3,并使用树布局。我已复制 http://mbostock.github.com/d3/talk/20111018/tree中的代码。 html 与我的树数据,但我想多做一点。

I have been transitioning my code from JIT to D3, and working with the tree layout. I have replicated the code from http://mbostock.github.com/d3/talk/20111018/tree.html with my tree data, but I wanted to do a little more.

在我的例子中,我想创建子节点合并回来形成一个较低级别的父级,我意识到更多是一个有向图结构,但是树来适应这(即注意子节点之间的公共id应该合并)。

In my case I wanted to create child nodes that merge back to form a parent at a lower level, which I realize is more of a directed graph structure, but would like the tree to accomodate this (i.e. notice that common id's between child nodes should merge).

因此,基本上一棵树在从父母到子女的路上像正常一样分裂,但是后来也有能力把那些子节点组合在一起成为父母)。

So basically a tree that divides like normal on the way from parents to children, but then also has the ability to bring those children nodes together to be parents (sort of an incestual relationship or something :)).

问类似的东西 - >
如何使用D3布局非树层次结构

Asks something similar -> How to layout a non-tree hierarchy with D3

我可能能够使用分层边缘绑定与树层次结构布局,但我没有看到这样做。

It sounds like I might be able to use hierarchical edge bundling in conjunction with the tree hierarchy layout, but I haven't seen that done. I might be a little off with that though.

推荐答案

我一直在使用一个库,名为 dagre ,用于在JavaScript中布局有向图。我们有如何与D3配合使用的示例。也许这符合您的需要?

I've been working on a library, called dagre, for laying out directed graphs in the JavaScript. We have an example for how it can be used with D3. Maybe this suits your needs?

这篇关于d3树 - 父母有相同的孩子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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