Making a Bar Chart
✓ Published2🌍 Public
This example shows a horizontal bar chart of country populations, using a bar’s length to encode each country’s population value and a band scale for country names along the y-axis. The chart is rendered as SVG with D3 v5, loading data from a CSV file via `d3.csv` and scaling the population values by 1000. Axes are created with `d3.axisLeft` and `d3.axisBottom`, while linear and band scales (`d3.scaleLinear`, `d3.scaleBand`) position the bars. The bars use a fixed steelblue fill, with margins applied to the plotting area.
AI-generated descriptionMIT Licensed