hm0693_Q1
✓ Published0🌍 Public
This example demonstrates how to create a pie chart using the D3.js library, visualizing the distribution of three Iris species, each with a count of 50. The chart is rendered as scalable vector graphics (SVG) with a legend displayed below. The code utilizes D3's `pie` function to compute arc data, `arc` for defining the pie slices, and `scaleOrdinal` with the `schemeCategory10` color palette. Percentage labels are positioned at the centroid of each arc, while a separate legend is constructed using HTML elements.
AI-generated descriptionAn example showing the capabilities of VizHub:
- Loads D3 via UNPKG (pinned at v6, since this runtime environment only supports UMD, and in v7 D3 dropped UMD support)
- Demonstrates use of
importfrom"d3". - Demonstrates use of
importfrom local ES6 modules.
MIT Licensed