Skip to main content
100%

Fork of Axes with React & D3

✓ Published0🌍 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.

MIT Licensed

Similar vizzes