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.

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 & exportHTML, source ZIP

Axes with React & D3

0 stars1Public
CChris Briggs
Last edited Nov 16, 2021
Created on Nov 16, 2021

This example shows a horizontal bar chart of population data for the top 10 countries in 2020, using React to render SVG elements and D3 to compute scales and ticks. It loads the UN Population 2019 dataset via `d3.csv`, then uses `d3.scaleBand` for the categorical y-axis, `d3.scaleLinear` for the numeric x-axis, and `d3.max` to set the domain. Axis ticks are generated with `xScale.ticks()` and drawn as lines and text, while rectangles represent each country’s population. The chart is styled with a left margin for country labels, and axes are positioned using SVG transforms.

AI-generated description

A program that loads in some data using D3 utilities, arc and pie and uses React to render the data as a radial burst. Data source: MDN Named Colors

Comments

Sign in to join the discussion.

MIT Licensed