Skip to main content
100%

Color Legends !

✓ Published1🌍 Public
SShareSha
Last edited Apr 14, 2020
Created on Apr 14, 2020

This example presents a reusable color legend component built with D3 v5. The visualization displays four categorical color swatches—apple, lemon, lime, and orange—using circles filled via a `scaleOrdinal` color scale. The `colorLegend` function, exported from `colorLegend.js`, appends grouped circle and text elements to an SVG, with spacing, text offset, and circle radius configured through its props. The legend is transformed into position using a `translate` attribute and rendered with the d3 `select` and `call` methods.

AI-generated description
MIT Licensed

Similar vizzes