Skip to main content
100%

Axes with React & D3

✓ Published0🌍 Public
NNikhil Sharma
Last edited Mar 21, 2022
Created on Mar 21, 2022

This example shows a horizontal bar chart comparing the population of ten countries from a UN 2019 dataset, rendered as SVG via React components. The chart displays country names on the y-axis and population values on the x-axis, with axes and marks built from reusable React components. The code uses D3’s `scaleBand` and `scaleLinear` for positioning, `csv` for data loading, and React’s `useState`/`useEffect` hooks for state management. Axis labels and ticks are generated manually from the scales, while bars are drawn as `<rect>` elements per data row.

AI-generated description
MIT Licensed

Similar vizzes