Skip to main content
100%

Refactor Bar Chart

✓ Published0🌍 Public
KKaiXuan Chin
Last edited Aug 5, 2021
Created on Aug 5, 2021

This visualization displays the top 10 most populous countries as horizontal bars, using React to render SVG elements and D3 scales to map country names and population values to screen coordinates. The code builds the chart by composing separate components for the axes and marks, with D3’s `scaleBand` and `scaleLinear` handling the data-to-pixel transformations. Data comes from the United Nations World Population Prospects 2019 CSV, loaded via D3’s `csv` function. The final chart includes axis lines and labels, positioning them relative to the margins and inner chart dimensions.

AI-generated description

A program that shows the top 10 most populous countries as a pathetic bar chart with no axes.

Data: United Nations World Population Prospects 2019.

MIT Licensed

Similar vizzes