Making a Bar Chart
✓ Published0🌍 Public
This example shows the population of the ten most populous countries in 2018, drawn as a horizontal bar chart with a customized axis. The chart uses D3 v5 APIs including `scaleLinear`, `scaleBand`, `axisLeft`, and `axisBottom` to position bars and render labels, with tick formatting that converts values to billions. Data from the United Nations World Population Prospects is loaded via `d3.json`, then multiplied by 1,000. The SVG output includes a title and axis label, with grid lines removed for a cleaner presentation.
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. It also demonstrates customization of D3 axes.
MIT Licensed