Gist a198389d0150b3f23ce2
This example demonstrates a simple column chart that handles negative values on the y-axis, using categorical data on the x-axis. It shows how bars extend above and below a zero baseline, with positive values in steelblue and negative values in brown. The chart is built with D3 v2, using an ordinal scale for the x-axis and a linear scale for the y-axis. It renders via SVG, with a reusable chart function that configures margins, axes, and bar dimensions based on the data.
AI-generated descriptionSee in action http://bl.ocks.org/3766585
This simple column chart shows how to handle negative values on the y axis. It handles ordinal values for the X axis only.
I started with this gist from Mike Bostock: https://gist.github.com/2368837 see it on blocks: http://bl.ocks.org/2368837
borrowed a bit from the histogram example in D3: https://github.com/mbostock/d3/tree/master/examples/histogram
and used the reusable chart convention from: http://bost.ocks.org/mike/chart/