🌍 Public
Viewing a saved revision (read-only)
92b3ddbea66047a7896d47cd872c9b06
Color and Size Legends
This example demonstrates two common legend types for D3 visualizations: an ordinal color legend for categories and a square-root size legend for quantitative values. The color legend maps fruit names to distinct colors, while the size legend encodes numeric values using proportional circle radii. Both legends are rendered as SVG groups using reusable functions that leverage D3's `scaleOrdinal`, `scaleSqrt`, and `selection.join` pattern for enter/update/exit handling.
AI-generated descriptionAn example showing the capabilities of VizHub.