Adding interactive legend in d3.js for vijuly weighted tree -
i new d3,this may seem silly question using d3 . trying implement http://vizuly.io/product/weighted-tree/. trying make interactive legend filters tree when legend clicked. not able figure out tree data structure ,how pass viz object in legend ,how make filtering work.
i want collapse nodes except 1 legend have clicked.
function onclicklegend(g,d){ // filtering or collapsing node , corresponding branches legend clicked switch(d) { case 0: viz.togglenode(data.values[0]); break; case 1: viz.togglenode(data.values[1]); break; case 2: viz.togglenode(data.values[2]); break; case 3: viz.togglenode(data.values[3]); break; case 4: viz.togglenode(data.values[4]); break; case 5: viz.togglenode(data.values[5]); break; case 6: viz.togglenode(data.values[6]); break; case 7: viz.togglenode(data.values[7]); break; case 8: viz.togglenode(data.values[8]); break; case 9: viz.togglenode(data.values[9]); break; case 10: viz.togglenode(data.values[10]); break; case 11: viz.togglenode(data.values[11]); break; case 12: viz.togglenode(data.values[12]);break; } }
Comments
Post a Comment