Skip to main content
100%

Bowl of Fruit - General Update Pattern Special Cases

✓ Published0🌍 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
MIT Licensed

Similar vizzes