Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Color and size legends

Public visualization

Viewing a saved revision (read-only)

ae816be4c7204233af052f20cefde56e

Color and size legends

0 stars0🌍 Public
PPeter S
Last edited Sep 18, 2019
Created on Aug 24, 2019

Two reusable D3 v5 legends illustrate color and size encoding side by side in a React-based VizHub example. The color legend maps an ordinal scale with fruit categories to red, yellow, green, and orange circles, while the size legend uses a square-root scale to map numeric ticks to proportional circle radii. Both legends are built with SVG selections, enter/merge/exit patterns, and custom parameters like spacing and text offsets. The page also demonstrates asynchronous data loading with a Promise, filtering car listings to generate a formatted report.

AI-generated description

An example showing the capabilities of VizHub - color legend