Skip to main content
100%

How selectAll Works

✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on Apr 12, 2013

This animation demonstrates how `selection.selectAll` works in D3: every element in the old selection becomes a group in the new selection. Using an initial selection of table rows to create a selection of table cells, it visualizes the hierarchical grouping of `td` elements by their parent `tr`. The example builds side-by-side tree diagrams with `d3.layout.tree`, rendering SVG nodes and links, and animates transitions between states to show how the nested selection is constructed and mapped.

AI-generated description

This animation demonstrates how selection.selectAll works: every element in the old selection becomes a group in the new selection. Here, an initial selection of table rows is then used to create a selection of table cells:

d3.selectAll("tr").selectAll("td");

The result is a selection of table cells (td elements) grouped by their table row.

gpl-3.0 Licensed

Similar vizzes