Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Color and size legends

Public visualization

More options

Embed on a websiteCopy iframe embed code

The embed preserves the visualization's visibility and project dataset permissions.

Download & exportHTML, source ZIP and authorized project data

Source ZIP contains editable visualization files; it does not include project datasets. Standalone HTML is available where authorized and packages readable referenced data for offline use. Dataset ZIP requires project read permission.

Standalone HTMLSource ZIP
Publishing & handoffCopy a client maintenance summary

Includes the canonical link, visibility, and available export formats. Confirm dataset attribution, licensing and maintenance responsibilities with the publisher.

Color and size legends

0 stars2🌍 Public
MMaciek Sitkowski
Last edited Sep 3, 2020
Created on Sep 3, 2020

This example demonstrates two types of chart legends rendered side-by-side in SVG. A color legend uses a d3.scaleOrdinal to map fruit names to distinct colors, with circles and text labels offset vertically. A size legend uses d3.scaleSqrt to map a numeric domain to circle radii, filtering out zero, reversing the tick order, and positioning text labels using the scaled radius plus an offset. Both legends are implemented as reusable functions that manage enter/update/exit selections with D3 v5’s data join.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed