Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

margin making bar chart with react ad d3

Public visualization

Viewing a saved revision (read-only)

39c933dd15114185bdf68bdad28d3ee9

margin making bar chart with react ad d3

0 stars1🌍 Public
Wwzhang88
Last edited Nov 21, 2021
Created on Nov 21, 2021

The example shows a horizontal bar chart displaying the top 10 countries by population in the year 2000, using a clean margin-based layout. It loads CSV data from a GitHub gist via `d3.csv`. The chart uses React hooks (`useState`, `useEffect`) for state management and D3 v5's `scaleBand` and `scaleLinear` to map countries to y-positions and population values to bar widths, rendered as SVG `<rect>` elements within a translated `<g>` container.

AI-generated description

a program that load data and