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 stars0🌍 Public
YYifei Liu
Last edited Sep 13, 2020
Created on Sep 13, 2020

This example demonstrates D3’s general update pattern by animating a bowl of fruit through timed state changes. Apples are removed, replaced with lemons, or filtered out, with D3’s data join (`selection.data`, `enter`, `merge`, `exit`) updating SVG circles and text accordingly. The code uses `scaleOrdinal` for color and radius mapping, and `selection.attr` for positioning, rendering entirely as SVG. Each fruit’s identity is tracked via a random `id`, ensuring stable element binding across updates.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed