Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Activity 6_Question 2

Public visualization

Viewing a saved revision (read-only)

ec2abd0f77c84e8587c4193e1478e8d2

Activity 6_Question 2

0 stars0🌍 Public
BBharath Vupputuri
Last edited Apr 4, 2025
Created on Apr 4, 2025

This example visualizes the distribution of product sales across five regions as a stacked horizontal bar chart, using data from a CSV file with product rows and regional percentage columns. D3.js v7 with SVG rendering builds the chart, where each bar segment’s length encodes the percentage value per region, and tooltips reveal precise sales figures on hover. The code leverages `d3.csv` for data loading, `d3.stack` for computing the stacked layout, and `d3.scaleOrdinal` to assign colors to regions, with axes and legends generated via D3’s scaling and axis APIs.

AI-generated description