Skip to main content
Public

Share visualization

Loading preview…

Axes with React & D3

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Axes with React & D3

0
YYibo Zhang
Last edited Jan 13, 2022
Created on Jan 13, 2022

This example displays the top 10 most populous countries as a horizontal bar chart with axes, using React for component structure and D3 for scales and rendering. The code explicitly builds x-axis ticks with `xScale.ticks()` and y-axis labels from the scale’s domain, drawing SVG lines and text elements. It loads data from the United Nations World Population Prospects 2019 via `d3.csv`, applies a linear scale for population and a band scale for countries, and renders the chart as SVG within a React component.

AI-generated description

A program that shows the top 10 most populous countries as a pathetic bar chart with no axes.

Data: United Nations World Population Prospects 2019.

Comments

Sign in to join the discussion.

MIT Licensed