🌍 Public
Viewing a saved revision (read-only)
6322db7eda47412cb422024ad7e61488
Loading Data with React and Data
This example shows a horizontal bar chart of the top 10 countries by 2020 population, rendered as SVG using React. The code loads CSV data from a GitHub gist with `d3.csv`, then uses `scaleBand` and `scaleLinear` to map countries and population values to positions and bar widths. React’s `useState` and `useEffect` manage the asynchronous data loading, with a "Loading..." fallback until data arrives. Gridlines and axis labels are generated from the scales.
AI-generated descriptionFollow mouse with circle