Skip to main content
100%

Color and Size Legends

✓ Published0🌍 Public
RResl411
Last edited Nov 14, 2019
Created on Nov 14, 2019

This example demonstrates two reusable legend components rendered with SVG: a color legend for ordinal data and a size legend for quantitative data. The color legend maps fruit names to distinct colors, while the size legend uses `d3.scaleSqrt` to encode numeric values through circle radii. Both legends use D3 v5’s data join pattern, with Enter and merge selections to update ticks. The size legend calculates tick values via `scale.ticks` and filters out zero.

AI-generated description
MIT Licensed

Similar vizzes