Skip to main content
100%

Customizing axes

✓ Published1🌍 Public
Aakshayms0
Last edited Oct 21, 2022
Created on Oct 21, 2022
Forked from HTML Starter

This example shows a horizontal bar chart of the top 10 most populous countries, with population values converted from raw numbers to thousands and formatted with abbreviated tick labels (e.g., “1.41B”) using D3’s `format` and `.replace('G','B')`. The chart uses `d3.scaleLinear` for the x-axis and `d3.scaleBand` for the y-axis, with custom axis styling applied via CSS classes like `.tick text` and `.axis-label`. Grid lines are created by setting `tickSize(-innerHeight)` on `d3.axisBottom`, while the y-axis’s domain and tick lines are removed. Data comes from a local CSV file, and the SVG rendering is driven by React and D3 v7.

AI-generated description

A bare minimum HTML page demonstrating use of CSS and JavaScript.

See also React Starter.

MIT Licensed

Similar vizzes