Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Refactoring a Bar Chart

Public visualization

Viewing a saved revision (read-only)

bd8c0361f8594979b6fd88dfb11cfbfa

Refactoring a Bar Chart

0 stars1🌍 Public
Jjwlam83
Last edited Jan 13, 2022
Created on Jan 13, 2022

This bar chart displays the population of the top 10 countries from the UN Population 2019 dataset. React components render SVG rectangles for each bar, with the x-axis scaled by `d3.scaleLinear` and the y-axis using categories from `d3.scaleBand`. The code defines reusable `AxisBottom`, `AxisLeft`, and `Marks` components, and loads data asynchronously with `d3.csv` inside a custom `useData` hook, while D3 utilities like `max` and `scaleBand` handle the scaling logic.

AI-generated description

A program that loads in some data about CSS named colors using D3 utilities, and uses React to render the data