Skip to main content
100%

TnT Tree

✓ Published0🌍 Public
663anp3ca
Last edited Oct 9, 2018
Created on Oct 9, 2018

This example visualizes a phylogenetic tree from a Newick-formatted string, showing collapsible nodes that expand or collapse on click. It uses the TnT tree API alongside d3.v3, with circle nodes for expanded leaves and triangle nodes for collapsed branches. A button toggles the layout between vertical and radial orientations. Hovering over a leaf highlights the path from the root to that node by adding a CSS class to the relevant `path.tnt_tree_link` elements, using `d3.selectAll` and `classed` to manage the highlighting.

AI-generated description

Built with blockbuilder.org

This example is forked from Collapsible nodes.

This framework is awesome but i still feel very strange while using d3.selection.classed() function, for some of the path selections can not attach one specific class name. Very odd behavior!

More information relate to Newick Format please reference Wikipedia and TnT tree API.

forked from <a href='http://bl.ocks.org/1Cr18Ni9/'>1Cr18Ni9</a>'s block: <a href='http://bl.ocks.org/1Cr18Ni9/66cf9dd9093b17f3204632d155596840'>TnT Tree</a>

forked from <a href='http://bl.ocks.org/63anp3ca/'>63anp3ca</a>'s block: <a href='http://bl.ocks.org/63anp3ca/cae46688bce904e4d0a4244338ebf2d6'>TnT Tree</a>

mit Licensed

Similar vizzes