Making a bar chart
✓ Published1🌍 Public
This example shows a horizontal bar chart of population data for ten countries, using a linear scale for population values and a band scale for country names. The bars are rendered as SVG rectangles with a blue fill, and the chart includes left and bottom axes for reference. The code loads data from a CSV file using `d3.csv`, converts the population column to numbers, and builds the visualization with `d3.scaleLinear`, `d3.scaleBand`, `d3.axisLeft`, and `d3.axisBottom`. The SVG canvas is 960 by 500 pixels, with margins applied to position the plot area.
AI-generated descriptionMIT Licensed