Skip to main content
100%

Axes with React & D3

✓ Published1🌍 Public
Ssurikmeetr
Last edited Mar 8, 2021
Created on Mar 8, 2021
Forked from Margin convention

This example shows a horizontal bar chart of the top 10 most populous countries in 2020, using data from a CSV file loaded via the `csv` function from D3. The React `useState` and `useEffect` hooks fetch the data and manage the chart state. Axes are drawn manually with SVG elements, using `scaleBand` for the y-axis countries and `scaleLinear` for the x-axis population values, with tick marks generated from `xScale.ticks()`. Bars are rendered as SVG rectangles with widths mapped to population counts.

AI-generated description

Adding axes to the chart.

MIT Licensed

Similar vizzes