Skip to main content
100%

Customising Axes

✓ Published1🌍 Public
Yyktan89
Last edited Jan 5, 2020
Created on Jan 5, 2020
Forked from Making a Bar Chart

This example shows a horizontal bar chart ranking the world’s most populous countries, with custom styling for both axes. The chart uses D3’s `scaleBand` and `scaleLinear` to map country names and population values to screen coordinates, while `axisBottom` and `axisLeft` produce the ticks and grid lines. The y-axis’s default domain and tick lines are removed, and the x-axis labels are formatted using `format('.3s')` to abbreviate large numbers (e.g., converting G to B). The bars themselves are purple SVG rectangles, and the data comes from a CSV file listing population figures.

AI-generated description
MIT Licensed

Similar vizzes