Skip to main content
100%

Bowl of Fruit General Update Pattern

✓ Published2🌍 Public
Ccornshoots
Last edited Mar 15, 2021
Created on Mar 15, 2021
Forked from Making a face

This example demonstrates D3’s general update pattern for smoothly adding, modifying, and removing SVG circles over time. Using `d3.scaleOrdinal` for color and radius, the code binds fruit data to circles with a key function on `id`. Enter, update, and exit selections are merged, with 1000ms transitions animating positional and size changes. A series of `setTimeout` calls triggers state changes, showing an apple consumed, a lemon replacement, and a removal.

AI-generated description

An example showing the capabilities of VizHub:

  • Loads D3 via UNPKG.
  • Demonstrates use of import from "d3".
  • Demonstrates use of import from local ES6 modules.
MIT Licensed

Similar vizzes