Axes with React & D3
✓ Published1🌍 Public
This example shows a horizontal bar chart of population data for the top 10 countries in 2020, using React to render SVG elements and D3 to compute scales and ticks. It loads the UN Population 2019 dataset via `d3.csv`, then uses `d3.scaleBand` for the categorical y-axis, `d3.scaleLinear` for the numeric x-axis, and `d3.max` to set the domain. Axis ticks are generated with `xScale.ticks()` and drawn as lines and text, while rectangles represent each country’s population. The chart is styled with a left margin for country labels, and axes are positioned using SVG transforms.
AI-generated descriptionA program that loads in some data using D3 utilities, arc and pie and uses React to render the data as a radial burst. Data source: MDN Named Colors
MIT Licensed