Skip to main content
100%

Fork of Bowl of Fruit - Click to select

✓ Published0🌍 Public
CClara Hu
Last edited Mar 24, 2021
Created on Mar 24, 2021

This example demonstrates a dynamic fruit bowl visualization where apples and lemons are added, removed, and recolored over time. It shows how D3’s data join pattern, using `selection.data` with a key function on `id`, updates circle elements with smooth transitions via `transition().duration(1000)`. The code uses `d3.scaleOrdinal` for color and radius mapping, and `d3.range` to generate initial fruit data. Each fruit’s position is calculated by its index, with apples rendered larger and red, lemons smaller and yellow, all rendered as SVG circles in a 960x500 canvas.

AI-generated description
MIT Licensed

Similar vizzes