🌍 Public
Viewing a saved revision (read-only)
6b61326dd83c49fd8f9cdb538dd4fb80
Activity 6
This example uses a horizontal bar chart rendered with React and SVG to compare the 2010 populations of twenty countries. The chart sorts countries vertically using an ordinal scale and encodes population values with a linear scale, formatting large numbers with abbreviations (e.g., “1.5B”). It pulls data from a CSV file hosted on GitHub. The code leverages d3’s `scaleBand`, `scaleLinear`, `format`, and `csv` functions, along with custom React components (`AxisBottom`, `AxisLeft`, `Marks`) that render SVG elements. Tooltips display the formatted population value for each bar.
AI-generated descriptionA demonstration of how to start using D3 version 6.