Skip to main content
100%

Customizing Axes of Bar Chart

✓ Published2🌍 Public
JJohn Hamilton Bradford
Last edited Oct 30, 2018
Created on Oct 24, 2018
Forked from Making a bar chart

This example shows a horizontal bar chart ranking the top 10 most populous countries, drawn as SVG rectangles scaled by population values loaded from a CSV. It demonstrates customizing axes: the y-axis uses `d3.scaleBand` with tick lines removed, while the x-axis uses `d3.scaleLinear` with a `d3.axisBottom` that applies a custom tick formatter (converting abbreviations like “B” for billion) and negative tick sizes to create gridlines. The chart also adds axis labels and a title via SVG text elements, using D3 v5’s `select`, `csv`, and `scaleBand` APIs.

AI-generated description
MIT Licensed

Similar vizzes