Colour and Size Legends
✓ Published0🌍 Public
This example demonstrates two kinds of legends side by side: a color legend mapping ordinal categories to distinct hues, and a size legend using a square-root scale to encode quantitative values. Both legends animate their circle radii over one second using D3’s `transition`. The code uses `d3.scaleOrdinal`, `d3.scaleSqrt`, `selection.call`, and React is loaded for the framework, while all rendering is done via SVG. The size legend uses `sizeScale.ticks` to generate labeled values, excluding zero.
AI-generated descriptionMIT Licensed