Skip to main content
100%

Color Legend

✓ Published1🌍 Public
LLudovicGouverneur
Last edited Dec 5, 2018
Created on Dec 5, 2018

This example demonstrates how to create color and size legends in D3 v5 using reusable functions. It shows ordinal color scaling mapping fruit names to pastel colors, and a square-root size scale with transitioning circles. The SVG rendering includes animated transitions on the size legend, while text labels accompany each legend entry. The code uses `d3.scaleOrdinal`, `d3.scaleSqrt`, and D3's selection join pattern with `.enter()` and `.merge()`.

AI-generated description

Learn about update pattern - from video

MIT Licensed

Similar vizzes