Making a Bar Chart
✓ Published0🌍 Public
This example displays the populations of the ten most populous countries from the 2017 United Nations World Population Prospects, using a horizontal bar chart. It loads data from a CSV file with `d3.csv`, then maps values with `d3.scaleLinear` and `d3.scaleBand`, and renders axes via `d3.axisLeft` and `d3.axisBottom`. Rectangles are appended to an SVG container, with bar widths proportional to population, and the chart refreshes when the data promise resolves.
AI-generated descriptionThis bar chart shows population of the top 10 most populous countries. The data comes from the year 2018 estimate in United Nations: World Population Prospects 2017.
MIT Licensed