Making a Bar Chart
✓ Published0🌍 Public
This example shows a horizontal bar chart comparing the population of ten countries, from China down to Mexico, based on United Nations data. Using D3 v6, the visualization maps population values to bar widths with a linear scale and country names to vertical positions with a band scale. Axes are rendered via `d3.axisLeft` and `d3.axisBottom`, while `d3.csv` loads the dataset and `d3.max` calculates the domain. The bars are drawn as SVG rectangles with steelblue fill, and the population values are converted from thousands to raw numbers in the loading callback.
AI-generated descriptionBasic example of bar-chart developed from population data from United Nations
MIT Licensed