Skip to main content
100%

Fork of Color and Size Legends

✓ Published1🌍 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
MIT Licensed

Similar vizzes