🌍 Public
Viewing a saved revision (read-only)
bdb85023d7a74b0ebd6f03b35763828a
Making a Bar Chart
This example demonstrates how to build a horizontal bar chart from scratch using D3 v5 in a React framework. The visualization displays population data for ten countries, with bars rendered as SVG rectangles scaled linearly by population and positioned using a band scale for country names. The code explicitly uses D3’s `scaleLinear`, `scaleBand`, `axisLeft`, and `axisBottom` functions, reading data from a CSV file. Axes are appended to a grouped SVG element, and bar heights are determined by the band scale’s bandwidth.
AI-generated descriptionA bare minimum HTML page.
See also React Starter.