🌍 Public
Refactored Bar Chart
This example shows a horizontal bar chart of the top 10 countries by 2020 population, as listed in the UN Population 2019 CSV dataset loaded via D3’s `csv` utility. The React component uses `scaleBand` and `scaleLinear` to map country names and population values to the SVG viewport, with the bars rendered as `<rect>` elements in `Marks.js`. The axis components `AxisBottom` and `AxisLeft` reuse D3’s scale functions directly, while React state managed by `useState` and `useEffect` handles asynchronous data loading.
AI-generated descriptionA program that loads in some data about CSS named colors using D3 utilities, and uses React state to keep track of the data.
MIT Licensed
Comments
Sign in to join the discussion.