Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Bar chart with margins&axes

Public visualization

Bar chart with margins&axes

0 stars1🌍 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

Comments

Sign in to join the discussion.

MIT Licensed