Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Bowl of Fruit - General Update Pattern

Public visualization

Viewing a saved revision (read-only)

c0a895ccbfea44f1a20f075f7756726f

Bowl of Fruit - General Update Pattern

0 stars0🌍 Public
Ffahmijaafar
Last edited Dec 5, 2019
Created on Dec 5, 2019

This example demonstrates the general update pattern in D3.js, showing how data joins handle entering, updating, and exiting elements. It visualizes a bowl of fruit—apples and lemons—as circles with color and radius scales, with text labels. Over time, fruits are eaten (removed), replaced, or filtered from the dataset, and the SVG updates accordingly. The code uses `d3.scaleOrdinal` for color and radius mapping, along with `selection.enter()`, `selection.merge()`, and `selection.exit().remove()` to manage SVG groups, circles, and text elements.

AI-generated description