🌍 Public
Viewing a saved revision (read-only)
0eb8b378e4cc41e5bcf1a77a8b58606a
Color and size legends
This example demonstrates a color legend with two categorical entries, “apple” and “lemon,” each represented by a colored circle and a text label. Using D3.js v5, the `scaleOrdinal` API maps the categories to distinct colors, while a custom `colorLegend` function positions the circles and labels horizontally across the SVG canvas. The visualization is rendered as SVG elements, with the legend items spaced based on an offset calculation and the height parameter passed from the parent SVG.
AI-generated description