Skip to main content
Public

Share visualization

Loading preview…

Fork of Rendering data with React and 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

Fork of Rendering data with React and D3

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

This example shows a horizontal bar chart of the top 10 countries by 2020 population, rendered as SVG rectangles. It loads UN population data from a CSV file using `d3.csv`, then maps the data to React state with `useState` and `useEffect`. The chart uses `d3.scaleBand` for the y-axis country categories and `d3.scaleLinear` for the x-axis population values, with each bar’s width and position computed from these scales. React renders the SVG elements, while D3 handles data parsing and scaling.

AI-generated description

Rendering Data with React and D3

Comments

Sign in to join the discussion.

MIT Licensed