Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Activity 7.1

Public visualization

Activity 7.1

0 stars0🌍 Public
NNagalakshmi Thota
Last edited Nov 6, 2024
Created on Nov 6, 2024
Forked from Hello VizHub

This pie chart displays the distribution of fruit quantities sold, with each slice representing a fruit type and labeled with its percentage of total sales. The visualization loads CSV data from a GitHub repository, converts the "Quantity Sold" field to numeric values, and uses D3.js v7's `d3.pie()` and `d3.arc()` generators to create the SVG arcs. A categorical color scale (`d3.scaleOrdinal` with `d3.schemeCategory10`) assigns distinct colors to each fruit, while percentage labels are positioned using `arc.centroid()`. A custom HTML legend below the chart maps each color swatch to its corresponding fruit name.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed