A6_Q2
✓ Published0🌍 Public
A stacked bar chart visualizes smartphone market share across five price ranges—Low, Mid, High, Premium, and Ultra Premium—for six brands. Each horizontal bar represents a brand, with colored segments depicting the proportional share in each price tier. The code uses D3.js v7, building an SVG with `d3.select`, `d3.scaleBand`, and `d3.scaleLinear` for axes, and `d3.stack` to aggregate the data. Color mapping is handled via `d3.scaleOrdinal`, and a legend is manually constructed using `svg.append`. The synthetic dataset defines share values for each brand and price range.
AI-generated descriptionMIT Licensed