Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

D3 Bar Chart (Refactoring React)

Public visualization

Viewing a saved revision (read-only)

b6d5a342aacc4a93b60cf85f230faf26

D3 Bar Chart (Refactoring React)

0 stars1🌍 Public
ZZoe Ferencova
Last edited Mar 8, 2023
Created on Mar 8, 2023

This visualization presents a horizontal bar chart of the ten most populous countries in 2020, using data from the UN Population dataset. It showcases a refactoring pattern where D3’s scale functions and tick generation are used within React components to render SVG elements. The code demonstrates using `d3.scaleBand` and `d3.scaleLinear` for axes and bar positioning, while custom React components like `AxisBottom`, `AxisLeft`, and `Marks` encapsulate SVG line, text, and rect elements. The rendering is pure SVG, dynamically generated from a CSV file via `d3.csv`.

AI-generated description

Half way towards a smiley face.