Skip to main content
100%

Color and Size Legends

✓ Published0🌍 Public
Ggilbster
Last edited Jan 6, 2020
Created on Dec 31, 2019

This example demonstrates how to create separate legends for ordinal color scales and quantitative size scales using D3 v5. The color legend displays four fruit categories with distinct colored circles, while the size legend uses a square root scale to show five tick values with proportionally sized semi-transparent circles. Both legends are built with reusable functions that bind data to SVG groups, using `selection.merge` and `transition.attr` for smooth updates. The SVG output uses class-based styling for tick text and circles.

AI-generated description
MIT Licensed

Similar vizzes