Skip to main content
100%

Refactored Bar Chart

✓ Published1🌍 Public
CChristian Potdevin
Last edited Mar 27, 2021
Created on Mar 27, 2021

This refactored bar chart displays United Nations population data for ten countries, using horizontal bars where length encodes population. Built with React and D3 v5, it separates chart components into distinct modules for axes and marks, rendering the visualization as SVG. The code loads the CSV via `d3.csv`, calculates scales with `d3.scaleBand` and `d3.scaleLinear`, and uses React hooks (`useState`, `useEffect`) to manage asynchronous data loading, with each bar rendered as a `<rect>` element.

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