E22 - the Margin Convention on Basic Bar Chart
✓ Published1🌍 Public
VVanessa
Last edited Mar 8, 2021
Created on Mar 8, 2021
This example shows a basic horizontal bar chart of regional trip volumes using the D3 margin convention. The chart loads CSV data from a GitHub gist with D3’s `csv` utility, then uses React hooks (`useState`, `useEffect`) to manage asynchronous data fetching. Rendering is done as SVG, with `scaleBand` for the categorical y-axis (regions) and `scaleLinear` for the numeric x-axis (trips). The margin object defines inner chart dimensions, and a transformed `<g>` element positions the bars within the SVG canvas.
AI-generated descriptionA program that loads in some data about CSS named colors using D3 utilities, and uses React to render the data as a radial burst!
MIT Licensed