Assignment2-Task2
This stacked bar chart compares the counts of ten fast-food and coffee chains across ten cities in the Dallas area, with each bar segment representing a specific brand's store count per city. The chart uses a horizontal layout, with cities on the y-axis and a linear count scale on the x-axis. The visualization is built with D3.js, using `scaleBand` and `scaleLinear` for axes, `d3.stack()` to aggregate the categorical data, and `scaleOrdinal` with a custom color array for series differentiation. SVG rectangles render the bars, and mouse events trigger a custom tooltip that displays the precise store count for each segment. Interactive highlighting is achieved by adjusting rectangle opacity on hover, while a legend and axis labels clarify the data.
AI-generated descriptionStacked bar chart of Yelp data: top cities
https://observablehq.com/@stefanreifenberg/basic-stacked-bar-chart-from-the-d3-js-gallery