Customizing Axes
This example visualizes the population of the top 10 most populous countries from the United Nations' 2018 World Population Prospects, using a bar chart with customized axes. The chart displays country names on the y-axis and population values on the x-axis, with gridlines extending across the plot. Built with D3 v5, the code uses `d3.axisBottom` and `d3.axisLeft` to generate axes, and customizes tick formatting via `d3.format` (converting "G" to "B" for billions). The x-axis label and title are added as text elements, while tick lines and domain paths are selectively removed or styled through CSS.
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.