A pie chart is a circular statistical graphic, which is divided into slices to illustrate numerical proportion.
import React, { useState } from 'react';
import { Chart } from 'primereact/chart';
const PieChartDemo = () => {
const [chartData] = useState({
labels: ['A', 'B', 'C'],
datasets: [
{
data: [300, 50, 100],
backgroundColor: [
"#42A5F5",
"#66BB6A",
"#FFA726"
],
hoverBackgroundColor: [
"#64B5F6",
"#81C784",
"#FFB74D"
]
}
]
});
const [lightOptions] = useState({
plugins: {
legend: {
labels: {
color: '#495057'
}
}
}
});
return (
<div className="card flex justify-content-center">
<Chart type="pie" data={chartData} options={lightOptions} style={{ position: 'relative', width: '40%' }} />
</div>
)
}
Built-in component themes created by the PrimeReact Theme Designer.
Premium themes are only available exclusively for PrimeReact Theme Designer subscribers and therefore not included in PrimeReact core.
Beautifully crafted premium create-react-app application templates by the PrimeTek design team.