Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Legend

Public visualization

Legend

0 stars0🌍 Public
SShane Carey
Last edited Apr 19, 2019
Created on Apr 19, 2019

This example shows a simple categorical color legend using two circular swatches labeled "OW2DWL" and "OW2DSWL," rendered as SVG within a 960-by-500 pixel canvas. The legend is built with the D3 v5 library, using `scaleOrdinal` to map the two domain categories to orange and blue fills. A reusable `colorLegend` function appends groups, circles, and text elements, positioning them vertically with a spacing offset and applying a text offset for labels. The visualization demonstrates a straightforward, declarative approach to creating a static legend with a minimal data set.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed