Skip to main content
100%

Mental Health Survey Pie Chart

✓ Published1🌍 Public
JJoe Rozman
Last edited Oct 24, 2024
Created on Sep 27, 2024

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 description

An 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:

Full Playlist: Constructing Visualizations

MIT Licensed

Similar vizzes