我试图在我的应用程序中使用Force-Directed Graph。 但我真的很难用标签数据来实现它。
我的标签数据结构如下:
for each Tag{
"name":<The name of the tags>
"friends":<a list of names of other tags that this tag need to be connected with>
}
我注意到在example链接中有源节点和目标节点的索引。 但我的动态数据并不是这样。
有什么想法吗?
顺便说一下,我使用AngularJS和D3,数据是Angular。
谢谢!
答案 0 :(得分:0)
我的最后一种方法是使用angular指令。在指令的函数中,我首先生成链接对象,然后执行其他d3操作。这个article非常有用!我的unperfected代码为here。