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

3
KKurt J Nilsen
Last edited Aug 3, 2020
Created on Aug 2, 2020

This example demonstrates the general update pattern for data joins in D3 v5, showing how a bowl of fruit responds to dynamic changes in an array. The visualization renders apples, lemons, and grapefruits as circles with distinct radii and colors, using `scaleOrdinal` for both color and radius mappings. As the data changes through timed events—removing fruits, swapping an apple for a lemon, and adding a grapefruit—the SVG elements transition smoothly over 1000 milliseconds. The code uses D3's `selectAll`, `data`, `enter`, `merge`, and `exit` methods within a React framework, with a bowl drawn as a rectangle behind the fruit.

AI-generated description

A bare minimum HTML page.

See also React Starter.

Comments

Sign in to join the discussion.

MIT Licensed