bowl of fruit-nested version update pattern
✓ Published0🌍 Public
This example demonstrates the enter-update-exit pattern with nested selections in D3. The code uses `selection.enter()` and `selection.merge()` to bind fruit data to SVG groups, each containing a circle and text, with `scaleOrdinal` mapping fruit types to colors and radii. Timed mutations—removing an apple, changing a fruit to a lemon, and removing another—show how the visualization updates smoothly, with exiting groups removed via `.exit().remove()`. The SVG rendering uses a simple bowl shape drawn with a rect.
AI-generated descriptionMIT Licensed