Skip to main content
100%

Refactored Bar Chart

✓ Published1🌍 Public
GGabriel Dias Menezes
Last edited Jun 1, 2022
Created on Jun 1, 2022

This example shows a horizontal bar chart of population data for the top 10 countries in 2020, using React to render SVG elements. It fetches the UN Population dataset via `d3.csv`, then uses `scaleBand` and `scaleLinear` from D3 v7 to map country names and population values to screen coordinates. The chart is composed of three reusable React components for the bottom axis, left axis, and the bars themselves, with each axis tick and bar generated as separate SVG elements. The visualization demonstrates a modular, component-based approach to building D3 charts within a React framework.

AI-generated description

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

MIT Licensed

Similar vizzes