Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Fork of Bowl of Fruit - General Update Pattern

Public visualization

Fork of Bowl of Fruit - General Update Pattern

0 stars0🌍 Public
SSuzie1022susu
Last edited Jan 10, 2023
Created on Jan 10, 2023

This example demonstrates the general update pattern in D3.js by animating a bowl of fruit as apples are eaten and replaced with lemons over time. The visualization uses SVG circles and text labels rendered through a custom `fruitBowl` function, which leverages `selection.enter()`, `selection.merge()`, and `selection.exit()` to handle data joins. The code applies ordinal scales from `d3.scaleOrdinal` for fruit colors and radii, and uses `d3.select` and `setTimeout` to trigger sequential state changes from the initial five apples.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed