Making a Bar Chart
✓ Published2🌍 Public
This example demonstrates a horizontal bar chart comparing the populations of ten countries, using a CSV data source. It renders as an SVG using D3 v5, loading data with `d3.csv` and scaling with `d3.scaleLinear` and `d3.scaleBand`. The chart draws axes via `d3.axisLeft` and `d3.axisBottom`, and creates steel-blue bars with an applied `d3.selection` and `.append('rect')`. The code sets the chart’s dimensions from the SVG attributes and applies margins for clear presentation.
AI-generated descriptionMIT Licensed