Skip to main content
100%

Trying to Use D3 with Viewing Data

✓ Published0🌍 Public
Ssophburke
Last edited Sep 24, 2019
Created on Sep 22, 2019

This example builds a horizontal bar chart of country populations using React to render SVG elements, with D3 scales for layout. The chart displays population values from the United Nations World Population Prospects 2019 dataset, formatted in billions with a custom tick label function. D3’s `scaleBand` positions the categorical country labels on the y-axis, while `scaleLinear` maps population counts to bar widths on the x-axis. A loading state appears before data arrives, and basic tooltips show exact values on hover through the SVG `<title>` element.

AI-generated description

Trying to make this code appear as stylized - not having luck.

Data: United Nations World Population Prospects 2019.

MIT Licensed

Similar vizzes