May 2019
Beginner to intermediate
650 pages
14h 50m
English
The path() method from d3.hierarchy() can be used to obtain the path between two arbitrary points in a tree. The descendants() and ancestors() methods contain subtrees and or a list of nodes between the current node and the root. You can also obtain a list of leaves, or filter other nodes based on their data. Any of these sets can be revealed by highlighting in a tree visualization using a selection to turn on or off CSS classes that change the appearance of graphical elements.
This example will reveal the path from a node to the root when the mouse is over the node (see Interactive/1-highlight.html). It uses the following CSS to style selected nodes and links:
path.faded { stroke: lightgray;}path.highlighted { stroke: ...Read now
Unlock full access