Show tooltips of multiple node by hovering on a node in D3.js

Viewed 1271

Using D3 examples (1) and (2), I created a collapsible tree view in D3 where each node of tree has some information in its tooltip.

Please see my work here. In the tree, node1 and node2 are collapsible/expandable. Expanding node2 will create node4 and node5.

Each node is showing its tooltip on hovering (using mouseover,mousemove,mouseout events). Every node knows its parent and its children.

Now, my requirement is: when a node X is hovered, tooltips of all nodes in path from root to X, should be visible simultaneously.

For example: when I should hover node4, tooltips of three nodes: node1, node2 and node4 should be visible.

How can I achieve it in my example?

1 Answers
Related