javascript - How to see what nodes are selected with d.selected ? D3/JS -


how can make array of selected nodes ? ie d.selected ?

i have force layout graph , want sort out selected nodes , hide unselected.

is there way loop through selected nodes, add them array , can sort them accordingly.

for example. every node has name applied , names beginning a,b , c. have function sorts out nodes customised layout (names starting on 1 line, b next , c next) works every node, not selected.

what wish happen sort selected nodes out , hide unselected

peoplearray = []; peopleindex = [];  for(i = 0; < people.data.nodes.length;i++)     {                if(!peoplearray[people.data.nodes[i].name])          {             peoplearray[people.data.nodes[i].name]=1;              peopleindex.push(people.data.nodes[i].name);         }         else{             ++peoplearray[people.data.nodes[i].name];         }     } 

you can data bound selection calling .data() without arguments, i.e.

var selected = d3.selectall(".selectednode").data(); 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -