Skip to main content
100%

Color and Size Legends

✓ Published0🌍 Public
Ssiddharth171
Last edited Jul 27, 2020
Created on Jul 27, 2020

This example demonstrates how to construct separate color and size legends for a visualization. The color legend uses a categorical ordinal scale to map fruit names to distinct colors, while the size legend uses a square-root scale to map a numeric domain to circle radii. Both legends are implemented as reusable functions that append groups of circles and text labels to an SVG canvas using D3 v5 methods like `scaleOrdinal`, `scaleSqrt`, and `selection.enter().append`. Data is encoded purely through visual channels, with no underlying dataset.

AI-generated description
MIT Licensed

Similar vizzes