Skip to main content
100%

D3 Shapes - Stacked Area - .offset(d3.stackOffsetExpand)

✓ Published1🌍 Public
SSubhendu Karmakar
Last edited Jan 1, 2024
Created on Jan 1, 2024

A stacked area chart displays five days of fruit quantities, with each day normalized to a full vertical stack using `d3.stackOffsetExpand`, so the y-axis represents proportional shares. Three colored areas—apricots, blueberries, and cherries—are generated with `d3.area()` and rendered as SVG paths inside an SVG element. The data comes from a hardcoded array, and the chart uses `d3.stack()` with keys for each fruit type, mapping each series to a color from a predefined palette.

AI-generated description
MIT Licensed

Similar vizzes