Color and size legends
✓ Published0🌍 Public
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 descriptionA bare minimum HTML page demonstrating use of CSS and JavaScript.
See also React Starter.
MIT Licensed