Skip to main content
100%

Axis with react and d3

✓ Published1🌍 Public
AAlex Gomes
Last edited Mar 1, 2022
Created on Mar 1, 2022

This example displays a horizontal bar chart of the top 10 countries by 2020 population, loaded from a CSV file via `d3.csv`. It combines React state management with D3 scales: `d3.scaleBand` positions country labels on the y-axis while `d3.scaleLinear` maps population values to bar widths. The SVG rendering includes axes with tick marks and labels generated from `xScale.ticks()`, with bars drawn as `<rect>` elements and a loading message shown before data arrives.

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.

MIT Licensed

Similar vizzes