I am new to d3.js, I am creating a visualization based on surburst. Can somebody let me know how I can get siblings elements external element in d3.js.
how to get silbling elements in sunburst
590 views Asked by Nagendra Busam At
1
I am new to d3.js, I am creating a visualization based on surburst. Can somebody let me know how I can get siblings elements external element in d3.js.
The main part of building the hierarchy from your data will be done by d3. Check the spec for
partition.nodes(root)
on how this information is put into the nodes. Basically, d3 will populate each node with a reference to itsparent
and itschildren
providing all that is needed to navigate the hierarchy.As a starting point you may have a look at this sunburst diagram. When hovering over an arc, this arc as well as its ancestors up to the root node are highlighted. The selection of nodes up the hierarchy which are to be highlighted takes place in a single function:
An even simpler version of this function will select the node and its siblings instead of the ancestors:
I adapted the above example to a plunk demonstrating how this may help solve your problem. In this plunk the hovered node and its siblings will get highlighted.