Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Fork of Bowl of Fruit - General Update Pattern Special Cases

Public visualization

Viewing a saved revision (read-only)

20bf7c02149e4381afab60056a8831bc

Fork of Bowl of Fruit - General Update Pattern Special Cases

0 stars1🌍 Public
Aannadehtiarova
Last edited Feb 1, 2021
Created on Feb 1, 2021

This example demonstrates the general update pattern in D3, showing how data joins handle enter, update, and exit transitions for a bowl of fruit. It illustrates special cases by using two ordinal scales (colorScale and radiusScale) from d3-scale to map fruit types to visual properties. The code runs through a sequence of timed updates using setTimeout: buying five apples, eating one, replacing one with a lemon, and removing another. SVG circles and text elements are bound to fruit objects, with the bowl rendered as a stationary rectangle. The example uses d3-selection for joins and merges, with D3 v5 loaded via CDN.

AI-generated description