Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Bar Graph 2

Public visualization

Viewing a saved revision (read-only)

82d22531ecd242bfbb27897b5cb66f82

Bar Graph 2

0 stars0🌍 Public
Aabhashdiu
Last edited Oct 5, 2022
Created on Oct 5, 2022

This example displays a horizontal bar chart of the top ten countries by 2020 population. It uses React's `useState` and `useEffect` hooks to asynchronously load CSV data from a GitHub gist before rendering SVG rectangles. The visualization maps population values to bar widths using D3's `scaleLinear`, while country names are positioned along the y-axis with `scaleBand`. Rendering is handled entirely through React's declarative SVG output, with the chart updating once the data has been fetched.

AI-generated description

A program that loads in some data about CSS named colors using D3 utilities, and uses React state to keep track of the data. Use react to render data