Color and Size Legends
✓ Published0🌍 Public
LLiu2021311512
Last edited Apr 30, 2022
Created on Apr 30, 2022
Forked from Fork of Bowl of fruit - General Update Pattern
This example demonstrates how to construct separate legends for color and size encodings. The color legend maps ordinal data categories to distinct hues, while the size legend translates a continuous quantitative scale into proportional circle radii. Both legends are rendered as SVG groups using D3 v5, with the ordinal color scale and square-root size scale defined via `scaleOrdinal` and `scaleSqrt`. The legends are drawn through custom `colorLegend` and `sizeLegend` functions, which manage tick marks with circles and text labels.
AI-generated descriptionMIT Licensed