Making a Bar Chart
✓ Published1🌍 Public
This example shows a horizontal bar chart for the top 10 most populous countries, using population estimates from the 2018 United Nations World Population Prospects. It renders as an SVG, with bars drawn as rectangles whose lengths encode population values. The code uses D3 v3 APIs such as `d3.csv` to load the data, `d3.scale.linear()` and `d3.scale.ordinal()` for the axes, and `d3.svg.axis()` to draw them. A dropdown menu lets users select a cereal brand, triggering an animated transition that updates the bar heights and rescales the y-axis domain.
AI-generated descriptionThis bar chart shows population of the top 10 most populous countries. The data comes from the year 2018 estimate in United Nations: World Population Prospects 2017.
MIT Licensed