Question2_Activity_6
✓ Published0🌍 Public
This example shows a stacked bar chart that breaks down sales of three products—productA, productB, and productC—across four regions (North, South, East, West). The code reads a local `data.csv` file using `d3.csv` and `d3.autoType`, then builds the chart with D3 v7’s `scaleBand` for the x-axis, `scaleLinear` for the y-axis, and `d3.stack` to accumulate the segment values. Each region’s bar is divided into colored segments, with a legend identifying the product categories, and the y-axis is labeled “Sales.” The SVG output is generated directly through D3’s selection and append methods.
AI-generated descriptionAn example showing the capabilities of VizHub:
- Loads D3 via UNPKG.
- Demonstrates use of
importfrom"d3". - Demonstrates use of
importfrom local ES6 modules.
MIT Licensed