Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Bowl of Fruit - General Update Pattern Special Cases

Public visualization

Bowl of Fruit - General Update Pattern Special Cases

0 stars0🌍 Public
MMaarten van 't Wout
Last edited Dec 12, 2019
Created on Dec 12, 2019

This example demonstrates D3’s general update pattern with special cases for entering, updating, and exiting elements in a fruit bowl visualization. Five apples appear initially; one is removed, another is replaced by a lemon, and a third apple is deleted, showing how `selection.join` handles groups via `enter`, `merge`, and `exit`. The code uses `d3.scaleOrdinal` for colors and radii, and appends SVG `rect`, `circle`, and `text` elements. Data is plain JavaScript objects, with updates triggered by `setTimeout` calls.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed