Skip to main content
100%

Color and Size Legends

✓ Published0🌍 Public
Ssakhabutdinov
Last edited Dec 3, 2019
Created on Nov 26, 2019
Forked from Bowl of Fruit

This example demonstrates two common legend types for D3 visualizations: an ordinal color legend for categories and a square-root size legend for quantitative values. The color legend maps fruit names to distinct colors, while the size legend encodes numeric values using proportional circle radii. Both legends are rendered as SVG groups using reusable functions that leverage D3's `scaleOrdinal`, `scaleSqrt`, and `selection.join` pattern for enter/update/exit handling.

AI-generated description

An example showing the capabilities of VizHub.

MIT Licensed

Similar vizzes