Skip to main content
100%

Color and size legends

✓ Published0🌍 Public
NNkwachi Abel
Last edited May 31, 2022
Created on May 31, 2022

This example demonstrates two types of legends for data visualization: a color legend using `scaleOrdinal` for categorical data and a size legend using `scaleSqrt` for quantitative data. The color legend displays four fruit categories with distinct colors, while the size legend shows five ticks with circle radii scaled proportionally to values. Built with React and D3 v5, the SVG rendering uses custom `colorLegend` and `sizeLegend` functions that append groups, circles, and text elements to the chart.

AI-generated description

A bare minimum HTML page demonstrating use of CSS and JavaScript.

See also React Starter.

MIT Licensed

Similar vizzes