🌍 Public
Viewing a saved revision (read-only)
1be5db2338f64c49a62e6842d50b37f2
Making a bar chart
This example shows a horizontal bar chart of population data for ten countries, with bars sized proportionally to each nation’s population and labeled along the left axis. The code loads data from a CSV file, multiplies the population values by 1,000, and renders the chart as SVG using D3 v5 APIs such as `scaleLinear`, `scaleBand`, `axisLeft`, and `axisBottom`. Bars are drawn as `rect` elements, transformed into place with a margin-based group, while the axes are appended via D3’s axis components.
AI-generated description