🌍 Public
Viewing a saved revision (read-only)
d1cad0b6856b4a68b58b4e02c2ae34ce
Bowl of Fruit - Adding Fruit Labels (3)
This example demonstrates a data join updating a bowl of fruit, with apples and lemons represented as colored circles with labels. The visualization uses D3 v5’s general update pattern, calling `selection.enter()`, `merge()`, and `exit().remove()` to handle dynamic changes. Initialized with five apples, the render function uses `scaleOrdinal` for color and radius scales, then updates over time: removing the last fruit, changing one apple to a lemon, and filtering out another by index. SVG elements—a bowl `rect` and grouped `circle` and `text` elements—are rendered and repositioned via transform attributes.
AI-generated description