Skip to main content
Public

Share visualization

Loading preview…

Bowl of Fruit - General Update Pattern Special Cases

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 Special Cases

0
DDi Zhen
Last edited Jun 22, 2019
Created on Jun 22, 2019

This example demonstrates the general update pattern for handling special cases in data visualization. It shows a bowl of fruit where apples are added, removed, and replaced with lemons over time, using transitions that respond to changes in the underlying data array. The visualization uses D3 version 5 with SVG rendering, employing `scaleOrdinal` for both color and radius scales, and the `selectAll`/`enter`/`merge`/`exit` pattern to manage group elements. The code uses `setTimeout` to trigger sequential data modifications, then re-renders the scene to reflect each change.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed