Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Bowl of Fruit - General Update Pattern

Public visualization

Bowl of Fruit - General Update Pattern

0 stars3🌍 Public
Eexcalibur1987
Last edited Oct 3, 2019
Created on Oct 3, 2019

This example demonstrates the general update pattern in D3 by showing a row of fruit circles that change over time—apples are removed, one apple transforms into a lemon, and another apple disappears. The code uses `d3.scaleOrdinal` to map fruit types to colors and radii, and `selectAll` with `.enter()`, `.merge()`, and `.exit()` to handle data joins. SVG circles are appended and updated based on a `fruits` array, with timers (`setTimeout`) triggering each state change.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed