Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Fork of Axes with React & D3

Public visualization

Viewing a saved revision (read-only)

25e1ec98dcc745a2a8c29ec424c9ef46

Fork of Axes with React & D3

0 stars0🌍 Public
Pparshwa30122002@gmail.com
Last edited Aug 14, 2024
Created on Aug 14, 2024

This example renders a bar chart of the ten most populous countries, with a tooltip showing each country’s population on hover. It uses React’s `useState` and `useEffect` to fetch the data from the United Nations World Population Prospects 2019 CSV via d3’s `csv` loader, then maps the data to SVG rectangles. The axes are built using d3’s `scaleBand` and `scaleLinear`, with gridlines from `xScale.ticks()`. Mouse events trigger a React state change that displays a custom tooltip positioned at the cursor.

AI-generated description

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

Data: United Nations World Population Prospects 2019.