Skip to main content
100%

Fork of Bowl of Fruit - General Update Pattern

✓ Published0🌍 Public
Llrakla
Last edited Dec 28, 2021
Created on Dec 28, 2021

This example demonstrates the general update pattern for animating changes in a data-driven SVG visualization. It shows a bowl of fruit, initially containing five apples, which are then modified over time through a series of setTimeout operations: an apple is removed, one apple is replaced with a lemon, and another apple is deleted, illustrating enter, update, and exit transitions. The code uses D3 v5’s `select`, `range`, and `scaleOrdinal` APIs to map fruit types to circle colors and radii, with the `merge` method coordinating the incremental updates. The rendering approach is SVG, with circle positions fixed along the x-axis while their attributes (fill color, radius) and presence change dynamically.

AI-generated description
MIT Licensed

Similar vizzes