Skip to main content
100%

Bowl of Fruit General Update Pattern

✓ Published2🌍 Public
FFhouston17
Last edited Jun 15, 2020
Created on Jun 15, 2020
Forked from Intro to D3

A bowl of fruit visualizes a dynamic dataset of apples and lemons as circles inside a grey bowl, with each fruit's type encoded by color and radius using D3's `scaleOrdinal`. The example demonstrates D3's general update pattern, where `selection.selectAll` and `.merge()` handle entering, updating, and exiting elements as the fruit array changes over time. Through timed `setTimeout` calls, the code removes fruit, swaps an apple for a lemon, and filters the array, animating the SVG circles and labels to reflect the data mutations.

AI-generated description
MIT Licensed

Similar vizzes