Color and Size Legends
✓ Published0🌍 Public
Iianleekq
Last edited Feb 21, 2019
Created on Feb 20, 2019
Forked from Bowl of Fruit - General Update Pattern with Bowl
This example demonstrates two custom legend components rendered as SVG: a color legend using a d3 ordinal scale mapping fruit names to colors, and a size legend using a d3 square-root scale mapping numeric values to circle radii. The color legend places equally sized circles with labels, while the size legend shows varying circle sizes with tick values generated by `sizeScale.ticks()`. Both rely on D3’s data join pattern (`selectAll().data().enter()`) with explicit `spacing` and `textOffset` props for layout, and are called via the `selection.call()` method.
AI-generated descriptionMIT Licensed