Skip to main content
Public

Share visualization

Loading preview…

Bowl of Fruit - General Update Pattern

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Bowl of Fruit - General Update Pattern

2
NNathan Cheever
Last edited Dec 31, 2019
Created on Dec 30, 2019

This example demonstrates the D3 general update pattern by rendering a bowl of fruit as SVG circles that change over time. Using `d3.scaleOrdinal` for color and radius mapping, the `fruitBowl` function joins data to circle elements, handling enter, update, and exit selections with `.enter()`, `.merge()`, and `.exit().remove()`. Apples and lemons are distinguished by type, and timed interactions remove fruits or replace an apple with a lemon, showing how the visualization synchronizes DOM elements with changing data.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed