Skip to main content
100%

Fork of Fork of Fork of HTML Starter

✓ Published0🌍 Public
Mmounishnaidu96@gmail.com
Last edited Mar 28, 2024
Created on Mar 28, 2024

This example shows the calorie distribution of various foods using a pie chart, with a legend displaying each food's name and calorie count. It loads a CSV dataset from a GitHub gist using D3's `csv` function and renders the chart as SVG. The code uses `pie()` to compute arc data, `arc()` to generate the path segments, and `scaleOrdinal()` to assign categorical colors. Text labels and legend entries are added with `select()` and `append()`, while `format('.4~g')` formats the calorie values in the legend.

AI-generated description
MIT Licensed

Similar vizzes