Colour and Size Legends
✓ Published0🌍 Public
Animated fruit icons show how ordinal color and size scales encode categorical data. In this D3 v5 example, apples and lemons appear as red and yellow circles whose radius reflects a separate size scale. The `colorLegend` function uses the data join pattern, animating new circles from radius zero through `transition().duration(1000)`, while exits are removed. SVG rendering and the `scaleOrdinal` API handle the legend mappings.
AI-generated descriptionMaking a face with D3.
Loading D3 from script tag (which creates a global 'd3' with all of its methods
MIT Licensed