🌍 Public
Viewing a saved revision (read-only)
6c533c7aa61447a2989c7808355a89fd
Color and Size Legends
This example demonstrates two reusable legend components for D3 visualizations: a color legend using an ordinal scale to map named categories to distinct colors, and a size legend using a square-root scale to encode numeric values through circle radius. The legends render as SVG groups with circles and labels, using d3.scaleOrdinal and d3.scaleSqrt. Both components employ the enter/merge/exit pattern to update efficiently, with a video link provided in the README.
AI-generated description