Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Refactored Bar Chart

Public visualization

Refactored Bar Chart

0 stars1🌍 Public
JJanet Li
Last edited Aug 15, 2021
Created on Aug 15, 2021

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 description

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

Comments

Sign in to join the discussion.

MIT Licensed