Skip to main content
100%

Color and size legends

✓ Published0🌍 Public
Rrintisch
Last edited Oct 28, 2019
Created on Oct 25, 2019

This example demonstrates two distinct legend types for data visualization: a color legend and a size legend, both rendered as SVG. The color legend maps categorical values (apple, lemon, limes, orange) to distinct colors using `d3.scaleOrdinal`, while the size legend uses `d3.scaleSqrt` to map a numeric range (0–10) to circle radii, showing a proportional relationship. Both legends are built with the D3 library (v5) and its selective update pattern via `selection.merge`.

AI-generated description
MIT Licensed

Similar vizzes