Skip to main content
100%

Color and Size Legends

✓ Published0🌍 Public
Jjay
Last edited Feb 18, 2020
Created on Feb 18, 2020

This example demonstrates two distinct legend patterns for encoding data. A color legend uses a d3.scaleOrdinal to map categorical fruit names to colored circles, while a size legend employs d3.scaleSqrt to represent numeric values through circle radius, with tick marks generated via sizeScale.ticks. Both legends are built with D3 v5 data joins, appending SVG groups, circles, and text elements with configurable spacing and offsets, rendering in a standalone SVG canvas.

AI-generated description
MIT Licensed

Similar vizzes