Skip to main content
100%

Making a Bar Chart

✓ Published1🌍 Public
NNikki-gea
Last edited Aug 24, 2020
Created on Aug 24, 2020

This example shows a horizontal bar chart of names and ages from a CSV file, with the x-axis mapping age and the y-axis mapping names. It uses d3.csv to load the data, d3.scaleLinear for the x scale, d3.scaleBand for the y scale, and d3.axisLeft and d3.axisBottom to render the axes. Bars are drawn as SVG rectangles with steelblue fill, and the chart is positioned inside an SVG element using margins. The code dynamically adjusts the scales based on the data’s maximum value and number of entries.

AI-generated description
MIT Licensed

Similar vizzes