Activity_6_Q2
✓ Published0🌍 Public
This example visualizes sales distribution across product categories using a stacked horizontal bar chart. Each bar represents a category from a CSV file, segmented by price ranges (less than 100 to above 400) as percentages. The code uses d3.stack() to compute stacked series, d3.scaleBand for the y-axis categories, and d3.scaleLinear for the x-axis percentages, rendered as SVG rectangles. Interactive tooltips appear on mouseover, displaying the exact percentage for each segment. The visualization employs d3.axisBottom, d3.axisLeft, and d3.scaleOrdinal with a custom color palette.
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