Customizing Axes
This example presents a bar chart of the top 10 most populous countries, using 2018 estimates from the United Nations World Population Prospects. It shows how to customize D3 axes, including removing domain lines, styling tick marks, and adding axis labels in large fonts. The visualization uses d3.scaleLinear and d3.scaleBand for positioning, d3.axisLeft and d3.axisBottom for rendering, and d3.format to abbreviate population numbers (e.g., replacing “G” with “B”). Data is loaded via d3.csv and rendered as SVG rectangles.
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.