🌍 Public
Viewing a saved revision (read-only)
c09b5c79e2154834ad6ac4f27392f5c7
Rendering Data with React & D3 - barchart Basic
This example renders a horizontal bar chart of the top ten countries by 2020 population, sourced from a 2019 UN population CSV. The visualization combines React’s component-based state management with D3’s `csv`, `scaleBand`, and `scaleLinear` functions to map country names and population values to SVG rectangles. The `useState` and `useEffect` hooks asynchronously load and slice the data, while the categorical y-axis and linear x-axis position the bars within a 960-by-500 pixel viewport.
AI-generated descriptionReact Starter code.