Making a Bar Chart
✓ Published1🌍 Public
This example shows a horizontal bar chart of population data for the ten most populous countries, with each bar’s length proportional to population and country labels on the y-axis. The code uses D3 v5 primitives including `select`, `csv`, `scaleLinear`, `scaleBand`, `axisLeft`, and `axisBottom` to render an SVG visualization. Population values from the CSV are read as strings, multiplied by 1000, and then mapped to bar widths via a linear scale, while country names are mapped to y-positions using a band scale. The resulting chart is rendered with a minimal React-free setup inside an SVG container.
AI-generated descriptionA bare minimum HTML page.
See also React Starter.
MIT Licensed