Skip to main content
100%

D3 Legend Example

✓ Published0🌍 Public
CCurran Kelleher
Last edited Aug 6, 2015
Created on Aug 6, 2015

This example demonstrates how to create a color legend using the d3-legend library in conjunction with ColorBrewer color scales. The visualization renders an SVG-based legend with a series of colored swatches, each paired with a text label. The color palette is drawn from ColorBrewer's sequential schemes, providing visually distinct and perceptually uniform colors. The example highlights how to integrate a third-party legend library with D3's SVG rendering to efficiently produce clean, customizable legends for data visualizations.

AI-generated description

This example demonstrates use of the d3-legend library.

The color scale comes from ColorBrewer.

Similar vizzes