Activity 7-Q 1
✓ Published1🌍 Public
This example displays the distribution of chocolate sales percentages across eight chocolate types using a pie chart with a manually constructed legend and axis labels. It loads sales data from a remote CSV file and renders the chart as an SVG using D3 v6. The code uses `d3.csv` to fetch data, `d3.pie` to compute arc angles, `d3.arc` to generate SVG paths, and `d3.scaleOrdinal` to assign colors to each chocolate type. A static legend lists each type alongside its percentage, while text labels are placed at arc centroids.
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