🌍 Public
Viewing a saved revision (read-only)
24f1a2f4fb7e4bfcb5195e55f1074e9e
Making a Bar Chart
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