Skip to main content
100%

Axes with React and D3

✓ Published1🌍 Public
SSai Phaltankar
Last edited May 29, 2022
Created on May 29, 2022
Forked from Margin Convention

This example shows a horizontal bar chart of the ten most populous countries in 2020, using React to render SVG elements and D3 for data loading and scales. The App component fetches a CSV from a GitHub gist using `d3.csv`, transforms the population values, and slices the top ten rows. React’s `useState` and `useEffect` manage the asynchronous data, while D3’s `scaleBand` and `scaleLinear` position the bars and axes. Custom tick marks for both axes are generated manually with D3’s `ticks` method, and the chart updates reactively once data arrives.

AI-generated description

A program that loads in some data about CSS named colors using D3 utilities, and uses React to render the data.

MIT Licensed

Similar vizzes