Skip to main content
100%

Axes with React & D3

✓ Published1🌍 Public
Jjbruzzo
Last edited Jun 30, 2022
Created on Jun 30, 2022

This example builds a horizontal bar chart of United Nations population data for 2020, showing the top five countries by population size. It loads the CSV data with d3.csv, then uses React's useState and useEffect to store and manage the fetched data before rendering. Axes are manually constructed with d3.scaleBand and d3.scaleLinear, with tick marks and labels drawn as SVG elements. The bars and axis ticks are generated as React components, using d3's max and tick utilities to compute scales and intervals from the data.

AI-generated description

A program that loads in some data using D3 utilities, and uses React state to keep track of the data.

MIT Licensed

Similar vizzes