Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Loading Data with D3 and React

Public visualization

Viewing a saved revision (read-only)

106432fdf09d4a7d95e40768f1c3202c

Loading Data with D3 and React

0 stars0🌍 Public
KKenGondor
Last edited May 7, 2021
Created on May 6, 2021

This example shows a bar chart of the top 10 most populous countries for 2020, ranked by population, rendered as SVG in a React component. It demonstrates loading external CSV data with `d3.csv` in a React hook, then mapping that data to `scaleBand` and `scaleLinear` axes. Custom React components `AxisX` and `AxisY` programmatically draw ticks and labels using D3's scale methods, while bars are plain `<rect>` elements sized by the scales. The data originates from a UN population dataset hosted on GitHub.

AI-generated description

Smiley face implementation with React.