Stacked Negative Values
A diverging stacked bar chart displays quarterly fruit sales, with positive values for apples and bananas rising above the x-axis and negative values for cherries and dates descending below it. The chart uses d3.stack with the stackOffsetDiverging method to separate positive and negative series, while d3.scaleBand and d3.scaleLinear position the bars. d3.schemeCategory20 colors each fruit category, and SVG rect elements render the stacked segments. The data is hardcoded in the script, covering four quarters from Q1-2016 to Q4-2016.
AI-generated descriptionA diverging stacked bar chart, with negative values descending below the x-axis.
forked from <a href='http://bl.ocks.org/mbostock/'>mbostock</a>'s block: <a href='http://bl.ocks.org/mbostock/b5935342c6d21928111928401e2c8608'>Stacked Negative Values</a>
forked from <a href='http://bl.ocks.org/abrown004/'>abrown004</a>'s block: <a href='http://bl.ocks.org/abrown004/f08f38f5ff11d1d22dd9ce05fd803c10'>Stacked Negative Values</a>