Customizing Axes
This example shows a bar chart of the top 10 most populous countries using 2018 data from the United Nations, and it demonstrates how to customize D3 axes. The chart uses d3.scaleBand for the categorical y-axis, d3.scaleLinear for the numeric x-axis, and d3.axisBottom with a custom tick format that converts billions to "B". The code removes axis domains and tick lines, applies custom styling via CSS, and appends axis labels and a title. Rendering is done with SVG via D3 v5.
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.