Color and Size Legends
✓ Published0🌍 Public
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 descriptionMIT Licensed