Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Formatting axis

Public visualization

Viewing a saved revision (read-only)

fbb4db4ae07245c5ab18e8670e1df9ed

Formatting axis

1 star5🌍 Public
Aalisha-zemoso
Last edited Jul 7, 2022
Created on Jul 7, 2022

This example shows a horizontal bar chart of the top 10 most populous countries, with population values formatted using d3.format’s ".3s" abbreviation (e.g., 1.42M). The chart uses d3.scaleLinear for the x-axis, d3.scaleBand for the y-axis, and d3.axisBottom with a custom tickFormat to display compact population labels. Data is loaded from a CSV file via d3.csv, and the SVG rendering is driven by React-compatible D3 v7 code. Axis gridlines are removed, and a text label for the x-axis appears below the ticks.

AI-generated description

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

See also React Starter.