Skip to main content
๐ŸŒ Public

Share visualization

Send this visualization to others.

Axes with React & D3

Public visualization

Axes with React & D3

0 stars1๐ŸŒ Public
Rrvdv
Last edited Dec 22, 2021
Created on Dec 22, 2021

This example shows a horizontal bar chart of the top 20 countries by 2020 population, with custom axes rendered as React components. The code uses D3's `csv` loader to fetch UN population data, `scaleBand` for the categorical y-axis, and `scaleLinear` for the numeric x-axis. Instead of D3's axis generator, it manually maps over `xScale.ticks()` and `yScale.domain()` to produce SVG `<line>` and `<text>` elements for tick marks and labels. The visualization is built with React 17 and D3 v7, rendering SVGs directly in the DOM.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed