Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Bowl of Fruit-General Update Pattern

Public visualization

Bowl of Fruit-General Update Pattern

0 stars2🌍 Public
XX. N. Chu
Last edited Jun 22, 2020
Created on Jun 22, 2020

This example demonstrates the general update pattern for data joins in D3.js: a bowl of fruit rendered as circles where apples are red and large, lemons are yellow and small. Using `selection.data()` with a key function, entering circles start at radius zero while exiting circles shrink away, and merging circles update their fill and position. The visualization uses `d3.scaleOrdinal` for color and radius mappings, with `transition().duration()` for smooth animations as the fruit array is manipulated through timed `setTimeout` events.

AI-generated description

Demonstrates fundamental DOM manipulation using D3.js by making a smiley face whose eyebrows move.

Comments

Sign in to join the discussion.

MIT Licensed