Skip to main content
100%

Fork of Color and Size Legends

✓ Published0🌍 Public
Ssrinathsethumadhavan
Last edited Jul 6, 2021
Created on Jul 6, 2021

This example demonstrates reusable legend components for both ordinal color scales and quantitative size scales, rendered as SVG. The color legend uses `d3.scaleOrdinal` to map fruit categories to colors, while the size legend uses `d3.scaleSqrt` to map numeric tick values to circle radii. Both legends are drawn using custom selection-based functions that append SVG groups, circles, and text elements with d3’s selection API. The code runs in d3 v5 and renders within a single SVG element.

AI-generated description
MIT Licensed

Similar vizzes