Making a Bar Chart
This bar chart displays the happiness scores of nine world regions, using data from a class-provided dataset similar to the United Nations World Population Prospects. A colored bar represents each region, with a color scale from IndianRed to Red indicating higher scores. The visualization includes D3 scales (`scaleLinear`, `scaleBand`), axes, and a circular button that toggles an animated transition, smoothly resizing the bars via a custom `transitionWidth` function. Hovering over a bar updates a separate HTML div with the region’s name and population.
AI-generated descriptionThis bar chart shows population of the thirteen most populous countries. The data comes from the year 2018 estimate in United Nations: World Population Prospects 2017.
Note: That link doesn't give data for the year 2018 but for the year 2015. In this example, I've used the data provided in the class (which is close to the downloaded data).