Making a Bar Chart
✓ Published0🌍 Public
This example displays a horizontal bar chart of population figures for ten countries, with country names on the vertical axis and population values encoded as bar lengths on the horizontal axis. The chart is rendered as SVG using D3 v5. The code imports the data from a CSV file and uses D3's `scaleLinear` and `scaleBand` to map population and country names to coordinates, while `axisLeft` and `axisBottom` generate the chart’s axes. The bars are drawn as `rect` elements, and the population values are multiplied by 1,000 during data loading.
AI-generated descriptionA bare minimum HTML page.
See also React Starter.
MIT Licensed