Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Fork of Step 1 - A Basic Pie Chart

Public visualization

Viewing a saved revision (read-only)

e863b42b1afb442a8e1df3a40fbe99b3

Fork of Step 1 - A Basic Pie Chart

0 stars0🌍 Public
Mmrharis1
Last edited Dec 5, 2021
Created on Dec 5, 2021
Forked from D3

This example shows a basic pie chart created with D3 v4, rendering an SVG visualization of four labeled data categories with proportional slice sizes and distinct colors from the Category 20b scheme. The code loads D3 via UNPKG, uses `d3.select`, `d3.arc`, `d3.pie`, and `d3.scaleOrdinal` to generate the chart dynamically from a JavaScript array of label-count pairs. The repository also includes a separate Canvas-based pie chart implementation in `pie.js`, which draws segments and labels using context methods like `arc`, `fillText`, and `rect`, with data defined in a Module.

AI-generated description

An example showing the capabilities of VizHub:

  • Loads D3 via UNPKG.
  • Demonstrates use of import from "d3".
  • Demonstrates use of import from local ES6 modules.