Activity7_Question 1
✓ Published0🌍 Public
A pie chart visualizes the percentage distribution of a budget across five categories: Food, Transport, Housing, Savings, and Entertainment. The chart uses d3.pie() to compute arc angles and d3.arc() to generate SVG path slices, with a color scale mapping each category to a distinct color. Percent values are labeled inside each slice using arc.centroid() for positioning, and a separate legend lists the categories with their corresponding colors. The code defines fixed data in a JavaScript array and renders the chart as an SVG element using D3 v7.
AI-generated descriptionMIT Licensed