Making a Bar Chart
✓ Published3🌍 Public
This example shows a horizontal bar chart of population by country, ordered from most to least populous, with each bar’s length encoding the population value. The visualization uses d3.csv to load data from a CSV file, d3.scaleLinear for the x-axis, d3.scaleBand for the y-axis, and d3.axisLeft and d3.axisBottom for the axes. Bars are rendered as SVG rectangles, with a fixed margin and responsive inner chart area computed from the SVG’s width and height attributes. The code uses d3.v5 and is structured as a React-compatible plain JavaScript module.
AI-generated descriptionA bare minimum HTML page.
See also React Starter.
MIT Licensed