Skip to main content
100%

Fork of Color and Size Legends

✓ Published0🌍 Public
MMajaha21
Last edited May 4, 2021
Created on May 4, 2021

This example demonstrates reusable legend components for both ordinal color scales and quantitative size scales. The color legend renders colored circles with labels for fruit categories, while the size legend displays circles scaled by magnitude using a square-root scale. Both legends are implemented as custom D3 functions that bind data to SVG groups, using `selection.enter()` and `selection.merge()` for updates. The code utilizes `d3.scaleOrdinal`, `d3.scaleSqrt`, and `scale.ticks()` to generate tick values for the size legend.

AI-generated description
MIT Licensed

Similar vizzes