Skip to main content
100%

Axes with React and D3

✓ Published0🌍 Public
Aangelathacker123
Last edited Feb 17, 2022
Created on Feb 17, 2022

This example shows a horizontal bar chart ranking ten countries by their 2020 population, with the data sourced from a UN population CSV file fetched via `d3.csv`. React controls the SVG rendering, mapping each country name through `d3.scaleBand` for the y-axis positions and population values through `d3.scaleLinear` for bar widths. The chart uses `d3.max` to determine the x-axis scale domain, and React's `useState` and `useEffect` manage the asynchronous data loading and display a "Loading..." message until the data arrives.

AI-generated description

Uses React to render data

MIT Licensed

Similar vizzes