Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Color and size legends

Public visualization

Color and size legends

0 stars1🌍 Public
VVaggelisKlt
Last edited May 18, 2020
Created on May 18, 2020
Forked from HTML Starter

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

Comments

Sign in to join the discussion.

MIT Licensed