Skip to main content
100%

XYAxis with React & D3 with refactoring

✓ Published1🌍 Public
Eekorre1001
Last edited Mar 29, 2021
Created on Mar 29, 2021

This example shows a horizontal bar chart of population data for the top 10 countries in 2020, with axes rendered as SVG elements. The React components `AxisBottom`, `AxisLeft`, and `Marks` repurpose D3 scales—`d3.scaleBand` and `d3.scaleLinear`—to compute positions and sizes. The bottom axis uses `xScale.ticks()` for tick values, while the left axis maps country names from the data domain. Data is loaded asynchronously from a CSV via `d3.csv` and the React hook `useEffect`. The visualization demonstrates clean separation of axis and mark rendering through reusable, refactored functions.

AI-generated description

Uses react and D3 to render the data as a radial burst! data about CSS colors.

MIT Licensed

Similar vizzes