Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Axes width React & D3

Public visualization

Viewing a saved revision (read-only)

2ff393ea1dd24efdb9537f76f5693a5e

Axes width React & D3

0 stars1🌍 Public
HHaris Abdullah
Last edited Sep 30, 2021
Created on Sep 28, 2021

This example displays a horizontal bar chart of the top 80 countries by 2020 population, drawn as SVG elements. It uses React hooks (`useState`, `useEffect`) to load and manage data from a CSV file via D3’s `csv`, while D3’s `scaleBand` and `scaleLinear` map country names and population values to pixel coordinates. Axis ticks are rendered manually with D3’s tick generation, and each bar is a `<rect>` positioned by those scales. The layout includes explicit margins and uses D3’s `max` for domain calculation.

AI-generated description

A program that loads in some data about CSS named colors using D3 utilities, and uses React to render the data as a radial burst!