Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Fork of Activity7.1_Qustn 1

Public visualization

Fork of Activity7.1_Qustn 1

0 stars0🌍 Public
NNita
Last edited Apr 6, 2025
Created on Apr 6, 2025

This example shows an extended donut chart of social media platform usage, displaying the average hours per week spent on each platform as pie slices with labeled leader lines and a dynamic legend. The visualization uses D3 v7’s `d3.pie()` and `d3.arc()` to generate the slices from CSV data loaded via `d3.csv`, with `d3.scaleOrdinal` assigning categorical colors. Outer arc centroid positions and a custom `midAngle` function compute label placement, while connector polylines and text elements are appended directly to an SVG canvas. The legend is built dynamically by iterating over the data, with each row containing a colored rectangle and platform label.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed