Skip to main content
100%

Making a Bar Chart with React & D3

✓ Published1🌍 Public
JJohn Huang
Last edited May 28, 2021
Created on May 21, 2021

This example shows a horizontal bar chart of population data for the top 10 countries in 2020, rendered as SVG using React components. It loads data from a CSV via `d3.csv` in a custom `useData` hook, then uses `scaleBand` for the categorical y-axis, `scaleLinear` for the numeric x-axis, and `format` to abbreviate tick labels (e.g., converting "G" to "B"). The chart includes custom axis components and rect marks with built-in tooltips.

AI-generated description

A program that loads data via d3.

MIT Licensed

Similar vizzes