Skip to main content
100%

Color and Size Legends

✓ Published0🌍 Public
Ppin84
Last edited Jun 9, 2019
Created on Jun 9, 2019

This example demonstrates two methods of creating legends in a D3.js visualization: a categorical color legend showing fruit types with distinct colors, and a quantitative size legend representing numeric values with scaled circles. The SVG-based visualization uses D3 v5's scaling functions, specifically `scaleOrdinal` for the color mapping and `scaleSqrt` for the size mapping, with custom legend constructors `colorLegend` and `sizeLegend` building the tick marks, circles, and labels.

AI-generated description
MIT Licensed

Similar vizzes