Skip to main content
100%

general update pattern - bowl of fruit with text

✓ Published1🌍 Public
JJames Malvern
Last edited Mar 15, 2021
Created on Mar 15, 2021

A bowl of fruit demonstrates the D3 general update pattern, showing five apples that become one lemon while circles and text labels update together in SVG. The code uses `select`, `range`, and `scaleOrdinal` from D3 v5 to map fruit types to colors and radii, with `fruitBowl` as a local ES6 module handling enter, update, and exit selections. The single lemon replaces an apple at index 2, and the visualization re-renders with layered transitions on both shapes and text.

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