Skip to main content
Public

Share visualization

Loading preview…

Color Legend

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 Legend

0
Aanouckstbr@gmail.com
Last edited Apr 8, 2024
Created on Apr 8, 2024
Forked from Animations

This example demonstrates two reusable D3 legend components positioned on a single SVG: a color legend using an ordinal color scale for categorical items like fruits, and a size legend built from a square-root scale that maps numeric values to circle radii. The color legend renders colored circles with labels, while the size legend filters out zero values and reverses tick order. Both use enter/merge/exit selections via `selection.selectAll` and `.data` to update groups, with circle and text elements positioned through transform attributes.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed