I find this pretty cool d3 network diagram on a website (a json file is at the bottom of this page). Then I'm thinking about adding some kind of select box as filter to select data so specific shape of the nodes will be shown only. So I wrote a select box in html like this:
<select>
<option value="All">All</option>
<option value="circle">circle</option>
<option value="square">square</option>
</select>
What I want is when I choose All
, the whole network will be presented, when I choose circle
, only the circle nodes will be presented.
I'm not a javascript or html expert so I'm not sure how to let my selection in html script effect a json data. Also I'm thinking would that be easier if I just make the non-selected shape transparent? The data format in d3 network is quite tricky so I don't know adding a filter like this would have an effect on the links
part of json data?
Much appreciate for any advice
Thanks in advance