🌍 Public
Viewing a saved revision (read-only)
e149d72728e54565bdfa628c6a77d15b
Bowl of Fruit - General Update Pattern
This example demonstrates the general update pattern in D3.js, showing how data joins handle entering, updating, and exiting elements. It visualizes a bowl of fruit—apples and lemons—as circles with color and radius scales, with text labels. Over time, fruits are eaten (removed), replaced, or filtered from the dataset, and the SVG updates accordingly. The code uses `d3.scaleOrdinal` for color and radius mapping, along with `selection.enter()`, `selection.merge()`, and `selection.exit().remove()` to manage SVG groups, circles, and text elements.
AI-generated description