Skip to main content
100%

Pie Chart Update, IV

✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on May 30, 2013

This example demonstrates animated updates to a pie chart using D3’s data-join with a key function, switching between fruit categories. A set of radio buttons lets the user choose a fruit, and the chart’s arcs smoothly transition to reflect the regional counts for that fruit. The visualization renders as SVG, using `d3.layout.pie` and `d3.svg.arc` to compute and draw the arcs, while `d3.nest` groups the tab-separated dataset by fruit. Arcs are added, removed, and repositioned via `path.enter()`, `path.exit()`, and `path.attr("d", arc)`, with colors assigned by `d3.scale.category20()`.

AI-generated description

This example demonstrates using a data-join with a key function to update a pie chart.

Next: Animated Data-Join<br> Previous: Missing Data

gpl-3.0 Licensed

Similar vizzes