Skip to main content
100%

UN Population Bar Chart - Margins And Axes (Modular)

✓ Published1🌍 Public
Ppranav-vis
Last edited Sep 6, 2021
Created on Sep 6, 2021

This D3.js v7 and React modular example displays United Nations population estimates for the top five countries in 2020, using an SVG bar chart. Left and bottom axes delineate country names and population values, with gridlines, while each bar’s length maps the quantitative scale. The code separates concerns into dedicated modules—`axisBottom.js`, `axisLeft.js`, and `marks.js`—each exporting reusable functions. It employs `scaleBand` and `scaleLinear` from D3 to position bars and ticks, uses the `csv` loader to fetch the remote data source, and renders the chart inside a React interface with defined margins.

AI-generated description

Rendering CSS named colors from MDN.

MIT Licensed

Similar vizzes