Skip to main content
100%

pie chart ice 7

✓ Published0🌍 Public
UUday Kiran
Last edited Apr 1, 2025
Created on Apr 1, 2025
Forked from Fork of pie chart

This pie chart visualization displays website traffic by source, measured in thousands of visitors, with each slice labeled directly on the chart and accompanied by a color-coded legend. The code uses D3 version 6, specifically the `d3.pie()` layout function, `d3.arc()` for defining the pie geometry, and `d3.scaleOrdinal` with `d3.schemeCategory10` for categorical coloring. Data is loaded asynchronously from a raw GitHub Gist CSV file via `d3.csv()`, with each visitor value converted to a number before being passed to the pie layout. The visualization renders as SVG, with arcs drawn using `path` elements and centroid-based text labels, while the legend is constructed separately using `rect` and `text` elements positioned on the right side of the chart.

AI-generated description
MIT Licensed

Similar vizzes