Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Bowl of Fruit - General Update Pattern Special Cases

Public visualization

Viewing a saved revision (read-only)

0c1ceffe665c45b3b17fb28a182153e4

Bowl of Fruit - General Update Pattern Special Cases

0 stars0🌍 Public
JJames Xie
Last edited Feb 13, 2020
Created on Feb 13, 2020

This example demonstrates the general update pattern for entering, updating, and exiting SVG elements in D3 v5. It uses `d3.scaleOrdinal` to map fruit types to color and radius values, while the `fruitBowl` function binds fruit data to groups containing circles and text labels. The code shows how `merge` combines enter and update selections to apply shared attribute updates, with separate handling for exit selections. A static bowl rectangle is drawn independently, and the initial render shows five apples positioned in a row.

AI-generated description