Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Refactored Bar Chart

Public visualization

Refactored Bar Chart

0 stars0🌍 Public
JJeff Wagner
Last edited Jun 8, 2023
Created on Jun 8, 2023

This example shows a horizontal bar chart comparing the populations of the top 10 countries for 2020, with each bar’s length mapped to population and labeled by country name on the left axis. Built with React and D3 v5, the chart uses `scaleBand` for the categorical y-axis, `scaleLinear` for the quantitative x-axis, and renders SVG `rect` elements via a custom `Marks` component. Axes are constructed manually from `xScale.ticks()` and `yScale.domain()`, with data loaded asynchronously from a CSV file.

AI-generated description

React Starter code.

Comments

Sign in to join the discussion.

MIT Licensed