Sequential Color Legend in D3
✓ Published0🌍 Public
This example demonstrates how to generate a sequential color legend using Susie Lu’s d3-legend library. It renders a small SVG with a legend title and five color cells, mapping a domain of seven distance values to a red interpolator via `d3.scaleSequential` and `d3.interpolateReds`. The legend is created with `d3.legendColor()`, configured with a title and scale, and attached to an SVG group using a standard D3 selection and `.call()`. The chart uses D3 v7 and d3-legend v2.25.6, rendering entirely as inline SVG.
AI-generated descriptionDemonstration of the use of Susie Lu's d3-legend to display a color legend that uses a sequential color scale.
MIT Licensed