🌍 Public
D3 Bar chart
This example displays a horizontal bar chart of United Nations population estimates for 2020, using React to manage state and render SVG rectangles. The code loads CSV data via `d3.csv`, then maps country names to a `scaleBand` y-axis and population values to a `scaleLinear` x-axis. Each bar’s width is set by the scaled population, with heights determined by `yScale.bandwidth()`. The chart updates once data arrives, showing a loading message until then.
AI-generated descriptionA bare minimum HTML page.
MIT Licensed
Comments
Sign in to join the discussion.