Skip to main content
100%

hm0693_Q1

✓ Published0🌍 Public
Mmukkamalaharichandana@gmail.com
Last edited Mar 23, 2025
Created on Mar 23, 2025

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 description

An 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 import from "d3".
  • Demonstrates use of import from local ES6 modules.
MIT Licensed

Similar vizzes