Fork of Lesson 8: Making a bar chart
✓ Published0🌍 Public
This example shows a horizontal bar chart of the top 10 countries by population for 2020, using data loaded from a CSV file. The chart is rendered as SVG elements, with each bar’s width scaled proportionally to its population value. The code combines React hooks (useState and useEffect) to manage asynchronous data loading, while d3.csv, scaleBand, and scaleLinear handle the data parsing and scales. React renders the final SVG markup, and the data originates from the UN Population 2019 dataset.
AI-generated descriptionLoading data with React & D3
Data source: A dataset from MDN CSS colors: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
Uses react to render data
MIT Licensed