Skip to main content
100%

Bowl of Fruit - General Update Pattern

✓ Published2🌍 Public
WWarren-Fitzhenry
Last edited Jan 5, 2020
Created on Dec 28, 2019

Five apples rendered as red circles transition in and out of a bowl over time, demonstrating the D3 general update pattern in SVG. The code uses `selectAll` and `.data()` joins, followed by `.enter()` and `.merge()` to handle entering and updating elements, while `.exit().remove()` removes disappearing fruits. A `scaleOrdinal` maps fruit types to colors and radii, with 1000ms transitions animating radius and fill changes as fruit is eaten, replaced by a lemon, or filtered out.

AI-generated description

Making a face with D3.

Loading D3 from script tag (which creates a global 'd3' with all of its methods

MIT Licensed

Similar vizzes