Mental Health Survey Pie Chart
✓ Published1🌍 Public
This visualization shows the distribution of survey respondents across academic years using a pie chart, with each slice color-coded using `d3.schemeCategory10`. The code groups the mental health survey data by academic year through `d3.rollups`, sorts the categories, and renders the chart with `d3.pie` and `d3.arc` generators. A legend positioned at the top-right maps each color swatch to its corresponding academic year label. The SVG elements are sized dynamically to the container’s dimensions via `container.clientWidth` and `container.clientHeight`.
AI-generated descriptionAn approximation of a line chart using D3.js!
Watch the video and study the code to learn about:
- SVG Path Elements
- fill, stroke, stroke-width
- stroke-linecap, stroke-linejoin
- Vanilla HTML SVG Paths
- D3.line
- AI Assist
See also:
MIT Licensed