Pie Chart

A flexible pie chart component for visualizing proportional data with customizable styling options.

Design (30.0%)Development (40.0%)Marketing (20.0%)Support (10.0%)DesignDevelopmentMarketingSupportPie Chart

Usage

import PieChart from '@/components/PieChart';

export default function MyPage() {
  // Data for the pie chart
  const data = [
    { name: 'Design', value: 30 },
    { name: 'Development', value: 40 },
    { name: 'Marketing', value: 20 },
    { name: 'Support', value: 10 }
  ];

  return (
    <PieChart 
      width={300}
      height={300}
      data={data}
      colors={['#6366f1', '#a855f7', '#ec4899', '#f43f5e']}
    />
  );
}

Examples

Basic Pie Chart

A simple pie chart with default styling.

Design (30.0%)Development (40.0%)Marketing (20.0%)Support (10.0%)DesignDevelopmentMarketingSupportPie Chart
const data = [
  { name: 'Design', value: 30 },
  { name: 'Development', value: 40 },
  { name: 'Marketing', value: 20 },
  { name: 'Support', value: 10 }
];

<PieChart 
  width={300}
  height={300}
  data={data}
/>

Donut Chart

A donut chart created by setting an inner radius.

Design (30.0%)Development (40.0%)Marketing (20.0%)Support (10.0%)DesignDevelopmentMarketingSupportPie Chart
<PieChart 
  width={300}
  height={300}
  data={data}
  innerRadius={60}
  colors={['#6366f1', '#a855f7', '#ec4899', '#f43f5e']}
/>

More Data Points

A pie chart with more data points and custom colors.

Product A (35.0%)Product B (25.0%)Product C (20.0%)Product D (15.0%)Product E (5.0%)Product AProduct BProduct CProduct DProduct EPie Chart
const productData = [
  { name: 'Product A', value: 35 },
  { name: 'Product B', value: 25 },
  { name: 'Product C', value: 20 },
  { name: 'Product D', value: 15 },
  { name: 'Product E', value: 5 }
];

<PieChart 
  width={300}
  height={300}
  data={productData}
  colors={['#0ea5e9', '#06b6d4', '#14b8a6', '#10b981', '#84cc16']}
/>