Assignment 6: Bar Chart with Diverging Color Scale
A horizontal bar chart displays population growth rates for 35 countries, with bars extending from a central zero line and colored along a diverging red-yellow-green scale to distinguish negative from positive growth. The chart ranks countries by annual growth percentage, from the United States at 1.05% down to Germany at -0.35%, and includes country labels positioned beside each bar. The visualization uses d3.csv to load data, d3.scaleBand for the categorical y-axis, d3.scaleSequential with d3.interpolateRdYlGn for the diverging color scale, and d3.legendColor to render a horizontal legend. SVG rectangles represent the bars, with axes and labels drawn using d3.axisBottom and SVG text elements.
AI-generated descriptionUsed random values to create a CSV file that contained countries population growth.
I also used https://bl.ocks.org/tlfrd/187e45e0629711c4560cf6bcd0767b27 as reference to build the chart but then utilized different csv data, added different color scale, and legend.