🌍 Public
Viewing a saved revision (read-only)
6b66776910334fc0a5655dca7825ff91
assign-2
This example shows a pie chart displaying fruit quantities from a CSV dataset, using the D3.js v7 library and SVG rendering. The visualization computes slice geometries with `d3.pie()` and draws them with `d3.arc()`, while color assignments come from `d3.scaleOrdinal` with `schemeCategory10`. A legend, also built in SVG, maps each fruit name to its corresponding color using small rectangles and text labels positioned relative to the chart’s center. The code loads data asynchronously via `d3.csv`, and the chart is centered within a 400×400 pixel viewport.
AI-generated description