Skip to main content
100%

Dataviz 2020_Ep22 - 16. Axes with React and D3

✓ Published0🌍 Public
MMinwoo Pak
Last edited Jun 14, 2021
Created on Jun 14, 2021

This example shows a horizontal bar chart of United Nations World Population 2019 data, loading the first ten countries from a CSV file and rendering them as SVG rectangles. The chart demonstrates how to construct axes manually without D3 axis components, using `scaleLinear` and `scaleBand` to position elements. React manages the component state and rendering lifecycle, while D3 utilities handle data loading via `csv()` and scale creation through `max()`, `scaleLinear`, and `scaleBand`. For the x-axis ticks, the code calls `xScale.ticks()` to generate tick values and maps them to vertical grid lines, with the chart rendered inside an SVG `<g>` element using React's JSX syntax.

AI-generated description

A program that loads in the World Population 2019 data using D3 utilities, and uses both React & D3 to render the data (as a Bar Chart). Creating Axes of a graph(chart)

MIT Licensed

Similar vizzes