Skip to main content
100%

Simple bar graph in v4

✓ Published0🌍 Public
MMTClass
Last edited May 7, 2017
Created on May 7, 2017

This example presents a simple bar graph built with d3.js v4, displaying county populations from a CSV file fetched via a remote URL. The chart uses `d3.scaleBand` for the categorical x-axis and `d3.scaleLinear` for the numeric y-axis, with axes generated by `d3.axisBottom` and `d3.axisLeft`. Bars are rendered as SVG rectangles with a steelblue fill that turns brown on hover, and the data is loaded asynchronously with `d3.csv`. The layout is fixed to the viewport with margins and explicit SVG dimensions.

AI-generated description

This is a simple bar graph written using d3.js v4.

This graph is part of the code samples for the update to the book D3 Tips and Tricks to version 4 of d3.js.

forked from <a href='http://bl.ocks.org/d3noob/'>d3noob</a>'s block: <a href='http://bl.ocks.org/d3noob/bdf28027e0ce70bd132edc64f1dd7ea4'>Simple bar graph in v4</a>

forked from <a href='http://bl.ocks.org/MTClass/'>MTClass</a>'s block: <a href='http://bl.ocks.org/MTClass/9726fb46e7d67aa10fc2c74d0d92386d'>Simple bar graph in v4</a>

mit Licensed

Similar vizzes