Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Refactored Bar Chart

Public visualization

Refactored Bar Chart

0 stars1🌍 Public
RRajat Dangat
Last edited Mar 26, 2021
Created on Mar 26, 2021

This example shows a horizontal bar chart of the top ten countries by 2020 population, sourced from a CSV file of UN population data. The chart uses React components to render the visualization as SVG, with d3-scale for the `scaleBand` y-axis and `scaleLinear` x-axis positioning. Population values drive bar widths, while country names label the left axis. The code is refactored into separate, reusable components for the axes and marks, with data loading handled by a custom `useData` hook that uses d3.csv.

AI-generated description

Refactoring the bar chart.

Comments

Sign in to join the discussion.

MIT Licensed