Aller au contenu principal

PieChart Component

Description

The PieChart component provides a customizable Doughnut/Pie Chart using Chart.js. It supports:

  • Custom colors
  • Tooltip with percentage display
  • Legend positioning
  • Adaptive theming for light/dark modes

Props

PropTypeDefaultDescription
data{ value: number; label: string }[]-The data to be displayed.
colorsstring[]Default colorsCustom colors for segments.

Example Usage

import { PieChart } from "@nomana-it/liberty-core"

const chartData = [
{ value: 40, label: "Product A" },
{ value: 25, label: "Product B" },
{ value: 20, label: "Product C" },
{ value: 15, label: "Product D" },
];

export const PieChartExample = () => {
return (
<PieChart
data={chartData}
colors={["#1976d2", "#ff9800", "#4CAF50", "#E91E63"]}
/>
);
};

🔗 GitHub Repository (Core): Liberty Core
🔗 GitHub Repository (Test Project): Liberty Test
📖 Live Documentation: Liberty Core Docs
💖 Sponsor & Support: Sponsor Liberty Core