Customizing Axes
This example displays a horizontal bar chart of the top 10 most populous countries, using data from the United Nations World Population Prospects 2019. It demonstrates how to customize chart axes: the y-axis labels are left-aligned without tick lines, while the x-axis uses a custom tick formatter to convert large numbers (using `d3.format`’s `.3s` notation) to display billions as "B" instead of "G". The chart also includes vertical gridlines created by setting a negative tick size on the bottom axis. The visualization is built with D3 v5, using `d3.select`, `d3.scaleLinear`, `d3.scaleBand`, `d3.axisBottom`, and `d3.axisLeft`, rendering to an SVG element with CSS styling for fonts and colors.
AI-generated descriptionA program that shows the top 10 most populous countries as a bar chart.