Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

D3 Diverging Color Bar Chart

Public visualization

Viewing a saved revision (read-only)

1c0ef4af85af46acaf6b8fa14dbf0df5

D3 Diverging Color Bar Chart

0 stars2🌍 Public
Mmariahdiaz
Last edited Nov 8, 2022
Created on Oct 2, 2022

This interactive D3 bar chart visualizes the percentage change in natural gas consumption by the electric power sector across eleven U.S. states, with bars diverging from a central zero axis. Each bar’s fill color reflects the magnitude and direction of change using a sequential color scale based on the `interpolateRdBu` interpolator. The chart employs `d3.scaleBand` for the categorical y-axis, `d3.scaleLinear` for both the horizontal value scale and bar lengths, and `d3.axisBottom`, `d3.axisLeft`, and `d3.axisRight` for axis ticks. A `d3.legendColor` legend with nine cells maps the color scale to the numeric range. Data is loaded from a CSV file via `d3.csv`.

AI-generated description