Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Bowl of Fruit - General Update Pattern Special Cases

Public visualization

Viewing a saved revision (read-only)

fbb077f3e9d249da847e3f321c648314

Bowl of Fruit - General Update Pattern Special Cases

0 stars0🌍 Public
LLudovicGouverneur
Last edited Dec 5, 2018
Created on Nov 29, 2018

A bowl of fruit demonstrates key special cases in D3's general update pattern: appending a new element, modifying an existing one, and removing one. Five apples initially render as circles with labels; after one second an apple is removed, two seconds later one apple becomes a lemon, and after three seconds another apple disappears from the middle. The code uses d3.scaleOrdinal for color and radius mapping, selection.enter, merge, and exit methods within a custom fruitBowl function, rendering to SVG.

AI-generated description