Skip to main content
100%

Stacked Negative Values

✓ Published0🌍 Public
Mmbostock
Last edited Mar 12, 2020
Created on Mar 7, 2017

This example shows a diverging stacked bar chart for quarterly data, with positive and negative values extending above and below a central zero axis. The chart uses four categories (apples, bananas, cherries, dates) across four quarters, with negative values for cherries and dates. It is built with D3 v4, using `d3.stack()` with the `d3.stackOffsetDiverging` offset to align positive and negative series. Bars are rendered as SVG rectangles, scaled with `d3.scaleBand` and `d3.scaleLinear`, and colored via `d3.scaleOrdinal(d3.schemeCategory10)`.

AI-generated description

A diverging stacked bar chart, with negative values descending below the x-axis.

gpl-3.0 Licensed

Similar vizzes