Skip to main content
100%

Customizing Axes of a Bar Chart with D3.js

✓ Published1🌍 Public
XXin Li
Last edited Mar 21, 2021
Created on Mar 21, 2021

This example shows a horizontal bar chart of the top 10 most populous countries, with customized axes. The chart uses population data from a CSV file, displaying the country names on the y-axis and population values on the x-axis. Built with D3.js v6 and rendered as SVG, the code customizes the axes using `d3.scaleLinear`, `d3.scaleBand`, `d3.axisLeft`, and `d3.axisBottom`. It removes default axis domains, adds grid lines via tick sizing, and formats tick labels from billions to a custom "B" suffix.

AI-generated description

An example including some commonly used features of SVG.

MIT Licensed

Similar vizzes