Skip to main content
100%

Bar chart with margins&axes

✓ Published1🌍 Public
Ddanielscheeper@gmail.com
Last edited Jan 17, 2024
Created on Jan 15, 2024
Forked from Bar chart

This example visualizes the top 10 countries by 2020 population from a UN dataset as a horizontal bar chart. The React app loads CSV data with D3’s `csv` method, then uses `scaleBand` and `scaleLinear` to map countries and population values to SVG rectangles. Axes are drawn manually with `xScale.ticks()` for x-axis grid lines and labels, while y-axis country names are positioned using the band scale. The chart includes margins and a left-aligned plot area, rendered entirely as SVG.

AI-generated description

A program that loads some data

MIT Licensed

Similar vizzes