Skip to main content
100%

Titanic passenger class distribution

✓ Published1🌍 Public
Kkfhujosefsson@dons.usfca.edu
Last edited Apr 23, 2025
Created on Apr 23, 2025

This example shows the distribution of Titanic passengers across first, second, and third class, with percentage labels overlaid on each slice. A simple SVG pie chart is generated using D3 v7’s `d3.pie` and `d3.arc` layouts, with each slice filled by a hard-coded color and separated by white strokes. The dataset is hard-coded as three objects containing class name, count, and color. Labels are positioned via the arc `centroid` method and rendered as multi-line text elements showing both class and percentage.

AI-generated description
MIT Licensed

Similar vizzes