Skip to main content
100%

Bowl of Fruit - General Update Pattern Special Cases

✓ Published0🌍 Public
SSimon Pettersson
Last edited Jan 30, 2022
Created on Jan 30, 2022

This visualization demonstrates special cases of D3’s General Update Pattern for a dynamic “bowl of fruit.” It shows three sequential state changes—a fruit disappearing, one changing its type, and another being removed—while each circle’s radius and color scale ordinally by fruit type, and the bowl is a static rectangle. Using D3 v5’s `selectAll`, `.enter()`, `.merge()`, and `.exit()`, the code updates SVG groups and their circle/text children in place, with `scaleOrdinal` mapping apple and lemon to distinct colors and sizes. The SVG renders at 960×500, and the script drives changes via `setTimeout` callbacks.

AI-generated description
MIT Licensed

Similar vizzes