Skip to main content
100%

Bowl of Fruit - General Update Pattern

✓ Published1🌍 Public
JJordan Arnold
Last edited Mar 8, 2021
Created on Mar 8, 2021

Five circles representing apples initially fill the frame. D3's general update pattern adds, removes, and updates SVG `<circle>` elements as the underlying data array changes. The example uses `d3.select` to target the SVG, `d3.scaleOrdinal` to map fruit types to colors and radii, and `d3.range` to generate the initial dataset. After a second, a circle is removed; after another, an apple's type changes to a lemon, altering its color and size.

AI-generated description
MIT Licensed

Similar vizzes