javascript - how to display the node attributes like person's name photo and address in a force directed graph -
hi working on force directed graph example of d3.js library want fix positions of nodes. , when click on node want display pop shows image , info of user(node).
i'm going best answer, there lot cover in question, more of overview of more info, , bit started down right path.
please excuse shoddy links ( can't post more 2 yet...)
nodes can fixed position setting boolean "fixed" property of each individual node true.
see sections on: # force.nodes([nodes]) https://github.com/mbostock/d3/wiki/force-layout
to make nodes clickable, attach event listener node selection appending new nodes node selection. see here: github /mbostock/d3/wiki/selections#wiki-on
to add more properties each node, add data objects inside "node" array before joining selection.
here edit made show how can add drag behavior, , mouse "click" listener event toggle nodes between fixed=true , false, comments on add additional node properties, , possibly make function calls display more node info. https://gist.github.com/alexhornbake/6079321
the above edited following example. still refer example when confused, helpful/simple force layout example: gist github /mbostock/1095795
Comments
Post a Comment