Skip to main content
Version: 1.0.3

AnimatedPieChart

The AnimatedPieChart renders animated SVG pie and donut charts. Each slice springs in individually on mount, scales up on hover, and pairs with an interactive legend for slice highlighting. Donut mode supports configurable inner radius and custom center labels.

Browser Market Share

Global usage — Q2 2024

Installation​

ignix add component animated-pie-chart

Usage​

Basic Pie Chart​

import { AnimatedPieChart } from './components/ui/animated-pie-chart';

const data = [
{ label: "Chrome", value: 63.4, color: "#6366f1" },
{ label: "Safari", value: 19.7, color: "#ec4899" },
{ label: "Firefox", value: 4.1, color: "#10b981" },
{ label: "Edge", value: 3.9, color: "#f59e0b" },
{ label: "Other", value: 8.9, color: "#3b82f6" },
];

export default function Analytics() {
return (
<AnimatedPieChart
data={data}
title="Browser Market Share"
subtitle="Global usage - Q2 2024"
showLegend
showPercentages
/>
);
}

Donut Chart with Center Label​

const data = [
{ label: "Product A", value: 44000, color: "#6366f1" },
{ label: "Product B", value: 31000, color: "#ec4899" },
{ label: "Product C", value: 21000, color: "#10b981" },
{ label: "Services", value: 12000, color: "#f59e0b" },
];

<AnimatedPieChart
data={data}
title="Revenue Breakdown"
donutRatio={0.55}
centerLabel="$108K"
centerSubLabel="Total Revenue"
showLegend
/>

Props​

ParameterTypeDefaultDescription
dataPieDataPoint[]requiredArray of slice data with label, value, and optional color.
titlestring-Optional chart title.
subtitlestring-Optional subtitle below the title.
radiusnumber110Outer radius of the pie/donut in pixels.
donutRationumber0Inner radius ratio (0–1). Set > 0 to enable donut mode.
centerLabelstring-Primary label displayed in the donut center (donut mode only).
centerSubLabelstring-Secondary label below centerLabel.
showLegendbooleantrueShow the interactive side legend.
showPercentagesbooleanfalseRender percentage annotations on each slice.
animatebooleantrueEnable spring entrance animations.
variant'default' | 'dark' | 'glass' | 'minimal''default'Theme variant.
classNamestring-Additional CSS classes for the container.

PieDataPoint Object​

PropertyTypeDescription
labelstringSlice label displayed in the legend and tooltip.
valuenumberNumeric value used to compute the slice angle.
colorstringOptional CSS color. Falls back to the built-in palette.