Skip to main content
100%

Bowl of Fruits-General Update Pattern

✓ Published0🌍 Public
NNohaS
Last edited Sep 11, 2023
Created on Sep 10, 2023

This visualization demonstrates the general update pattern for D3.js data manipulation. It shows a bowl of fruits whose contents change over time—initially displaying five apples, then removing one apple, replacing another with a lemon, and finally removing a second apple. The example uses D3 v5’s `selection.selectAll`, `.enter()`, `.merge()`, and `.exit()` methods to handle DOM updates, with the `fruitBowl` function managing the SVG circle and text elements. The `scaleOrdinal` color and radius scales map fruit types to visual properties.

AI-generated description

Demonstrates fundamental DOM manipulation using D3.js by making a smiley face whose eyebrows move.

MIT Licensed

Similar vizzes