Skip to main content
100%

Axis react and D3 The margin convention ActualBarchar d# react

✓ Published2🌍 Public
JJonas Carvalho
Last edited Apr 7, 2021
Created on Apr 6, 2021

This example shows a horizontal bar chart ranking the top 10 countries by 2020 population, rendered as an SVG using React components and D3 scales. The chart uses `scaleBand` for the y-axis and `scaleLinear` for the x-axis, with custom `AxisBottom` and `AxisLeft` components that generate ticks and labels. Data is loaded asynchronously via `d3.csv` from a gist, sorted in descending order, then sliced to the top 10. Bars are drawn as `rect` elements in the `Marks` component using the computed scales.

AI-generated description

Loading data with d3 and using react

MIT Licensed

Similar vizzes