Skip to main content
100%

Rendering Data with React & D3 - barchart Basic

✓ Published1🌍 Public
Kkeitheade
Last edited Nov 4, 2021
Created on Nov 4, 2021

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 description

React Starter code.

MIT Licensed

Similar vizzes