Skip to main content
100%

Color and Size Legends

✓ Published1🌍 Public
ZZ-Richard
Last edited Jun 18, 2020
Created on Jun 15, 2020

Two reusable D3 v5 legend components render categorical and quantitative scales side by side in SVG. A color legend uses `scaleOrdinal` to map fruit names to colored circles, while a size legend uses `scaleSqrt` with `ticks` to display varying radii for a numeric domain. Both components handle enter, update, and exit selections via `selection.data`, `merge`, and exit removal, positioning circles and labels with spacing and text offsets.

AI-generated description
MIT Licensed

Similar vizzes