多层分层边缘捆绑 [英] Multilevel Hierarchical Edge Bundling
问题描述
我想实现多层分层边缘捆绑.通过这种方式,我想像树状边缘捆绑一样,灌输径向树的行为,例如层次结构和边缘捆绑.
I want to implement multilevel hierarchical edge bundling. By that I means I want to inculcate the behavior of radial tree like hierarchy and edge bundling like in Hierarchical Edge Bundling.
示例可视化为径向等级捆绑
我知道我需要为此使用两个d3.js布局.另外,我需要相应地更改json数据集.
I know I need to use two d3.js layout for that. Also I need to change my json dataset accordingly.
我的样本数据集仅适用于普通d3.js HEB
My sample dataset is only for normal d3.js HEB
[
{"name": "A", "imports": ["A1", "A2", "A3"]},
{"name": "B", "imports": ["B1", "B2", "B3"]},
{"name": "C", "imports": ["C1", "C2", "C3"]},
{"name": "Employees", "imports": ["Emp1", "Emp2", "Emp3"]},
{"name": "A1", "imports": ["Emp1", "Emp2"]},
{"name": "A2", "imports": ["Emp3", "Emp2"]},
{"name": "A3", "imports": ["Emp1", "Emp3"]},
{"name": "C1", "imports": ["Emp1", "Emp3"]},
{"name": "C2", "imports": ["Emp2", "Emp3"]},
{"name": "C3", "imports": ["Emp1", "Emp2"]},
{"name": "B1", "imports": ["Emp1", "Emp3"]},
{"name": "B2", "imports": ["Emp2", "Emp3"]},
{"name": "B3", "imports": ["Emp1", "Emp2"]},
{"name": "Emp1", "imports": ["A1","A3","B1","B3","C1","C3"]},
{"name": "Emp3", "imports": ["A3","A2","B2","B1","C2","C1"]},
{"name": "Emp2", "imports": ["A1","A2","B2","B3","C2","C3"]}
]
但是我想显示的关系是:
However the relation I want to show is:
A,B和C处于最高级别
A, B and C at highest level
A是A1,A2,A3的父级
A is parent of A1,A2,A3
B是B1,B2,B3和
B is parent of B1,B2,B3,
A是A1,A2,A3的父级
A is parent of A1,A2,A3
C是C1,C2,C3和
C is parent of C1,C2,C3,
因此,A1,A2,A3,B1,B2,B3,C1,C2,C3处于第二级
Thus, A1,A2,A3,B1,B2,B3,C1,C2, C3 are at second level
然后,我想通过如上数据集所示的边缘捆绑来显示Emp1,Emp2和Emp3与A1-C3的关系.
Then, I want to show the relation of Emp1, Emp2, and Emp3 with A1-C3 through edge bundling as shown in above dataset.
我希望我对此很清楚.因此,请告诉我如何显示此行为或关系以及数据集中需要进行哪些适当的更改.
I hope I am clear on that. So, please tell me how can I show this behavior or relation and what appropriate changes in the dataset is needed.
推荐答案
您的问题的一个近似解决方案是将以下JSON示例的改编版本保存在文本文件中(例如"test.json"):
An approximate solution to your question is to save the following adapted version of your JSON example in a text file (e.g. "test.json"):
[
{"name": "A.A1", "imports": ["Emp.Emp1", "Emp.Emp2"]},
{"name": "A.A2", "imports": ["Emp.Emp3", "Emp.Emp2"]},
{"name": "A.A3", "imports": ["Emp.Emp1", "Emp.Emp3"]},
{"name": "C.C1", "imports": ["Emp.Emp1", "Emp.Emp3"]},
{"name": "C.C2", "imports": ["Emp.Emp2", "Emp.Emp3"]},
{"name": "C.C3", "imports": ["Emp.Emp1", "Emp.Emp2"]},
{"name": "B.B1", "imports": ["Emp.Emp1", "Emp.Emp3"]},
{"name": "B.B2", "imports": ["Emp.Emp2", "Emp.Emp3"]},
{"name": "B.B3", "imports": ["Emp.Emp1", "Emp.Emp2"]},
{"name": "Emp.Emp1", "imports": ["A.A1","A.A3","B.B1","B.B3","C.C1","C.C3"]},
{"name": "Emp.Emp3", "imports": ["A.A3","A.A2","B.B2","B.B1","C.C2","C.C1"]},
{"name": "Emp.Emp2", "imports": ["A.A1","A.A2","B.B2","B.B3","C.C2","C.C3"]}
]
然后使用 edgebundleR 包,使用R生成D3边缘束图:
Then use R to generate an D3 edge bundle plot using the edgebundleR package:
install.packages("devtools")
devtools::install_github("garthtarr/edgebundleR")
setwd("path/to/dir/with/file")
edgebundle("test.json")
以下是结果的屏幕截图:
Here's a screenshot of the result:
这篇关于多层分层边缘捆绑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!