Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Color and size legends

Public visualization

Viewing a saved revision (read-only)

d1c5ce9c72a94d6f922be9fa81c3025e

Color and size legends

0 stars0🌍 Public
Rrintisch
Last edited Oct 28, 2019
Created on Oct 25, 2019

This example demonstrates two distinct legend types for data visualization: a color legend and a size legend, both rendered as SVG. The color legend maps categorical values (apple, lemon, limes, orange) to distinct colors using `d3.scaleOrdinal`, while the size legend uses `d3.scaleSqrt` to map a numeric range (0–10) to circle radii, showing a proportional relationship. Both legends are built with the D3 library (v5) and its selective update pattern via `selection.merge`.

AI-generated description