Skip to main content
100%

Setup the bars and margins

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

This example shows a horizontal bar chart displaying the ten most populous countries in 2020. The bars are drawn inside a margin-defined area, with a band scale for country names on the y-axis and a linear scale for population on the x-axis. Using React hooks like `useState` and `useEffect`, it fetches CSV data from a GitHub gist via `d3.csv`, then renders SVG rectangles with `d3.scaleBand` and `d3.scaleLinear`. The visualization avoids overlapping edges by translating the chart group by the specified margins.

AI-generated description

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

MIT Licensed

Similar vizzes