Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Fork of Bowl of Fruit - General Update Pattern Special Cases

Public visualization

Fork of Bowl of Fruit - General Update Pattern Special Cases

0 stars0🌍 Public
Llrakla
Last edited Dec 28, 2021
Created on Dec 28, 2021

This example demonstrates the general update pattern in D3 with special cases for data changes—removing, modifying, and reordering fruits in a bowl. It uses `d3.selectAll` and `d3.data` to bind an array of fruit objects to SVG groups, with `enter`, `merge`, and `exit` selections handling new, updated, and removed elements. The code creates circles and text labels, using `scaleOrdinal` for color and radius. Data transitions occur via `setTimeout` calls, showing how the visualization updates when fruits are eaten or replaced.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed