简体   繁体   中英

D3.JS: implementing Force-Directed Graph for my tag data structure

I'm trying to use the Force-Directed Graph in my application. But I'm really stuck in implementing it with my tags data.

My tag data structure is like:

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>
}

I noticed in the example links has indexes for source and target nodes. But I don't have this with my dynamic data.

Any idea?

BTW, I'm using AngularJS with D3 and data is in Angular.

Thanks!!

My final approach is using angular directive. In the functions for the directive, I first generates links object then do other d3 stuff. This article is very helpful! My unperfected code is here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM