Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Color and Size Legends

Public visualization

Color and Size Legends

0 stars0🌍 Public
Ppeterjchan
Last edited Apr 4, 2020
Created on Apr 4, 2020

This example demonstrates two types of chart legends rendered side-by-side as SVG. A color legend uses `d3.scaleOrdinal` to map fruit names to distinct colors, while a size legend uses `d3.scaleSqrt` to encode numeric values through circle radii. Both legends animate with `transition().duration()`, and the size legend filters out zero values from its ticks. Styling comes from CSS classes applied to the tick groups, with text and circles positioned dynamically.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed