🌍 Public
Viewing a saved revision (read-only)
c3d9583576fa4bf8afbbbb467b316218
Bowl of Fruit - General Update Pattern - singular elements
Jjblaskovich
Last edited May 7, 2020
Created on May 7, 2020
A bowl of fruit demonstrates the general update pattern for singular elements using d3 data joins. Apples and lemons are rendered as colored circles with labels, using ordinal scales for color and radius. The example shows enter, update, and exit selections through timed state changes: an apple is removed, a fruit changes type from apple to lemon, and another apple is filtered from the array. The code uses d3-selection's `.data()`, `.enter()`, `.merge()`, and `.exit()` methods to manage SVG groups and their circle and text children.
AI-generated description