Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Axes with React & D3

Public visualization

Viewing a saved revision (read-only)

481ce36668f24558ab1f5b778d8e66db

Axes with React & D3

0 stars1🌍 Public
BBenoit Mouly
Last edited Sep 5, 2022
Created on Jul 29, 2022

This example displays the top 10 most populous countries as horizontal bars with D3-generated axes inside a React component. It uses `d3.csv` to load UN population data for 2020, `d3.scaleBand` for the categorical y-axis, and `d3.scaleLinear` for the continuous x-axis. The React `useState` and `useEffect` hooks manage data fetching, while manual SVG elements render the axes ticks and gridlines, with D3’s `scaleBand().ticks()` providing numeric tick values.

AI-generated description

A program that shows the top 10 most populous countries as a pathetic bar char with no axes.