Skip to main content
100%

Shapes and Colors with SVG and CSS

✓ Published0🌍 Public
OOsekovS
Last edited Aug 18, 2020
Created on Aug 18, 2020

This example demonstrates two custom SVG legends rendered side by side: a color legend for ordinal categories and a size legend for quantitative values. The color legend uses `d3.scaleOrdinal` with distinct fruit categories, while the size legend employs `d3.scaleSqrt` to map numeric ticks to circle radii. Both legends are built using reusable functions that leverage D3’s data join pattern (`enter`, `merge`, `exit`) and are styled with CSS classes. The SVG output is rendered directly in the browser via D3 v5.

AI-generated description

An example including some commonly used features of SVG.

MIT Licensed

Similar vizzes