Viewing a saved revision (read-only)
1080a264e51b418c95ad75d048408ec6
Fork of Fork of Stacked bar chart of Yelp data: top cities
This stacked bar chart visualizes the distribution of ten food types (e.g., American, Italian, Mexican) across ten cities, excluding Boston, using Yelp data from a CSV file. Each horizontal bar is segmented by food category, with segment lengths proportional to the count of restaurants per cuisine, enabling quick comparison of culinary profiles between cities. The chart is built with D3.js, using `d3.scaleBand` for the city axis, `d3.scaleLinear` for the count axis, and `d3.scaleOrdinal` with a custom color palette for food types. The `d3.stack()` function transforms the data into stacked segments, and interactive tooltips display exact counts on mouseover via `d3.select` and a `toolTip` div. A legend and title annotate the visualization.
AI-generated description