Making a bar chart (customized axes)
This example visualizes the population of the top 10 most populous countries using a horizontal bar chart, based on 2018 estimates from the United Nations World Population Prospects. It demonstrates customized D3 axes, including a formatted bottom axis that abbreviates large numbers (e.g., converting billions to "B") and a left axis with tick labels and grid lines. The code uses D3 v5 APIs such as `scaleLinear`, `scaleBand`, `axisBottom`, `axisLeft`, and `format`, rendering the chart as SVG with styled rectangles and text labels.
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.
See also the first bar chart visualization that this one builds on: Making a Bar Chart.