Skip to main content
100%

D3 Barchart

✓ Published0🌍 Public
Ddabrze3@gmail.com
Last edited May 30, 2021
Created on May 30, 2021
Forked from D3 Playground

This example visualizes the diameters of planets in our solar system using a horizontal bar chart built with D3.js. The bars are rendered as SVG rectangles, scaled using `d3.scaleLinear` for the x-axis and `d3.scaleBand` for the categorical y-axis, which lists planet names sorted in descending order by diameter. The chart imports data from `planets.csv`, converts the diameter strings to numbers, and displays axes generated with `d3.axisLeft` and `d3.axisBottom`. The SVG canvas is 960 by 500 pixels, with margins applied via a group transformation.

AI-generated description

Reading in data and creating a bar chart.

MIT Licensed

Similar vizzes