Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Fork of Color and Size Legends

Public visualization

Fork of Color and Size Legends

0 stars1🌍 Public
Vvivianaaai@qq.com
Last edited Mar 16, 2023
Created on Mar 16, 2023

This example demonstrates two reusable legend components rendered as SVG: a color legend for ordinal data and a size legend for quantitative data. The color legend displays circles for apple, lemon, lime, and orange, while the size legend uses a square-root scale with five ticks. Both use D3 v5’s `scaleOrdinal` and `scaleSqrt`, with `selection.merge` to update entries efficiently. The components are defined as JavaScript modules and called via `.call()`, with styling applied through CSS classes.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed