🌍 Public
Viewing a saved revision (read-only)
1d49eb234aea4ca39070dfd882c3b1d8
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