Ep21 Bar Chart with React/D3
✓ Published1🌍 Public
GGordon Yang
Last edited Apr 8, 2021
Created on Apr 7, 2021
Forked from Fork of Ep20 Visualizing with React D3 tryPie
This example displays a horizontal bar chart of the top ten countries by projected 2020 population, sourced from a UN population dataset (CSV). Built with React and D3 v6, the app fetches data via `d3.csv`, sorts it, and renders SVG `<rect>` elements. It uses `scaleBand` for the y-axis countries and `scaleLinear` for the x-axis population values, with bar widths mapped to population counts and heights set by the band’s `bandwidth`. React’s `useState` and `useEffect` handle data loading, while `ReactDOM.render` mounts the chart into the root div.
AI-generated descriptionA bare minimum HTML page demonstrating use of CSS and JavaScript.
See also React Starter.
MIT Licensed