如何从bundle-layout数据而不是node-links创建d3强制有向图

时间:2014-06-09 21:55:11

标签: javascript json d3.js force-layout bundle-layout

我尝试使用d3制作类似于此(http://bl.ocks.org/mbostock/4062045)的力导向图,但我的数据目前格式不适用于大多数情况下使用的节点/链接/源/目标结构有向图。我遇到了Hierarchical Edge Bundling图(http://bl.ocks.org/mbostock/7607999,请参阅GitHub页面查看此示例的数据文件):

enter image description here

使用更简单的json格式,其中关联的节点列在"导入"每个节点的属性如下:

[
{"name":"Project500","size":721,"imports":["Jack","Gilly","Mark","Yolanda","Donna"]},
{"name":"Project400","size":4294,"imports":["Jack","Greg","Tess","Mark","Donna"]},
{"name":"Jack","size":721,"imports":["Project500","Project400"]},
{"name":"Gilly","size":721,"imports":["Project500"]},
{"name":"Mark","size":721,"imports":["Project500","Project400"]},
{"name":"Yolanda","size":721,"imports":["Project500"]},
{"name":"Donna","size":721,"imports":["Project500","Project400"]},
{"name":"Greg","size":721,"imports":["Project400"]},
{"name":"Tess","size":721,"imports":["Project400"]}
]

我试图弄清楚如何在力导向图中使用这种数据格式。到目前为止,我似乎没有运气,因为这种数据格式最初用于HEB的分层和捆绑功能。任何有关如何做到这一点的见解都非常感谢。

0 个答案:

没有答案