Skip to main content
100%

Customizing Axes

✓ Published1🌍 Public
MMajaha21
Last edited Apr 6, 2021
Created on Apr 6, 2021

This example shows a horizontal bar chart ranking country populations, with a linear x-axis and a categorical y-axis. D3’s `scaleLinear` maps population values to bar widths, while `scaleBand` positions the country labels with padding. Axes are generated using `axisBottom` and `axisLeft`, with tick labels formatted via `format('.3s')` to display compact numbers like “1.41M”. The chart updates from a CSV file, which the code loads with `d3.csv` and multiplies each population value by 1000.

AI-generated description
MIT Licensed

Similar vizzes