Skip to main content
100%

Color and Size Legends

✓ Published1🌍 Public
AAegon95
Last edited Nov 17, 2019
Created on Nov 14, 2019

This example demonstrates two reusable legend components built with D3 v5: a color legend using `scaleOrdinal` for categorical data and a size legend using `scaleSqrt` for quantitative data. The color legend renders colored circles with domain labels, while the size legend displays circles scaled proportionally to tick values with corresponding text offsets. Both legends are implemented as modular functions that append SVG groups and circles, using D3’s selection and merge pattern to handle updates efficiently.

AI-generated description
MIT Licensed

Similar vizzes