Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Pie Chart - Expenses

Public visualization

Pie Chart - Expenses

0 stars0🌍 Public
Ggayathrisaxena23@gmail.com
Last edited Mar 30, 2026
Created on Mar 30, 2026

This pie chart visualizes the proportional distribution of expenses across four categories: Food (40), Travel (20), Shopping (25), and Others (15). Built with D3.js v7, the SVG rendering uses the `d3.pie()` and `d3.arc()` generators to create the slices, with `d3.scaleOrdinal()` assigning distinct colors. The chart displays category labels positioned at each arc’s centroid using the `arc.centroid` method, and includes an HTML legend generated through D3's selection API. The hardcoded dataset drives the visualization, which is rendered entirely client-side in the browser.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed