Skip to main content
Public

Share visualization

Loading preview…

Color and size legend horizontal

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Color and size legend horizontal

1
JJoachim Klug
Last edited Sep 28, 2020
Created on Sep 28, 2020

A horizontal legend displays ordinal color and size encoding for two fruit categories, apple and lemon, using distinct red and yellow circles. Built with D3 v6, the visualization applies `scaleOrdinal` to map domain values to colors and a custom `colorLegend` function to position each legend item along the x-axis. SVG groups contain circles and text labels, with spacing and offsets controlled by passed properties, while the legend updates cleanly through enter/merge/exit selections.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed