Skip to main content
100%

Refactored Bar Chart

✓ Published1🌍 Public
Ccynichole
Last edited Feb 18, 2022
Created on Feb 18, 2022

This example shows a horizontal bar chart ranking the top 10 countries by population for 2020, using SVG rectangles to encode population values along the x-axis and country names along the y-axis. The visualization is built with React for component management and d3.v5 utilities, including `scaleBand`, `scaleLinear`, `csv`, and `max` for data loading and scaling. The data originates from a UN Population 2019 CSV file, fetched via d3's `csv` method and stored in React state with the `useState` and `useEffect` hooks. Custom React components for axes and marks handle the SVG rendering, with the chart embedded in a full-viewport body and production builds of React and D3 loaded via CDN.

AI-generated description

A program that loads in some data using D3 utilities and uses React state to keep track of the data.

MIT Licensed

Similar vizzes