Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Axes with React & D3

Public visualization

Viewing a saved revision (read-only)

6d78223a9db84584858aff5133594c17

Axes with React & D3

0 stars0🌍 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