Skip to main content
Explore
Solutions
Bespoke Studio
Pricing
Quick Start
Demo
Log in
Send feedback
✕
Tell us what works and what could be better. We read every submission.
Send feedback
✕
Tell us what works and what could be better. We read every submission.
Home
•
Fork Viz
Fork Viz
Create your own copy of this visualization.
Forking from
Bowl of Fruit - General Update Pattern Special Cases
Title
*
Description
This example demonstrates the general update pattern in D3, handling special cases when a data array changes through add, remove, and mutation operations. A row of apples rendered as SVG circles is modified over time: one apple is eaten, another becomes a lemon, and a middle apple disappears. The code uses D3’s `selectAll` with data joins, `.enter()`, `.merge()`, and `.exit()` to manage entering, updating, and exiting elements. The `fruitBowl` function uses scaleOrdinal to map fruit types to colors and radii, with circles and text labels positioned by index.
Visibility
Public
Private (only you), Pro
Unlisted (anyone with link)
Private work requires Pro.
Upgrade
Cancel
Fork Viz