Skip to main content
100%

D3 Piechart - with labels

✓ Published3🌍 Public
SSubhendu Karmakar
Last edited Dec 29, 2023
Created on Dec 29, 2023

This example shows a pie chart of fruit quantities, with each slice labeled by its fruit name. The chart uses the `d3.pie()` generator to compute arc data, and `d3.arc()` with inner and outer radii to create a donut-like shape. Slice paths are rendered in orange with white strokes, and labels are positioned at each arc’s centroid using `arcGenerator.centroid(d)`. Data is hard-coded in the JavaScript, and the visualization is drawn as SVG within an HTML page, styled by CSS.

AI-generated description

D3 Scales - scaleTime()

MIT Licensed

Similar vizzes