Skip to main content
100%

Refactor Bar Chart

✓ Published1🌍 Public
Jjbruzzo
Last edited Jun 30, 2022
Created on Jun 30, 2022

This example presents a horizontal bar chart from United Nations population data for ten countries, showing each country's 2020 population as a bar whose length is proportional to the value. Built with React components, it demonstrates a refactored approach to composing SVG visualizations using D3’s `scaleBand` and `scaleLinear` for positioning and scaling. The chart reads a CSV file via D3’s `csv` utility, and separate React components (`AxisBottom`, `AxisLeft`, and `Marks`) render the axes and bars, with React state managing the loaded data.

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