A doughnut chart is a variant of the pie chart, with a blank center allowing for additional information about the data as a whole to be included.
import React, { useState } from 'react';
import { Chart } from 'primereact/chart';
const DoughnutChartDemo = () => {
const [chartData] = useState({
labels: ['A', 'B', 'C'],
datasets: [
{
data: [300, 50, 100],
backgroundColor: [
"#FF6384",
"#36A2EB",
"#FFCE56"
],
hoverBackgroundColor: [
"#FF6384",
"#36A2EB",
"#FFCE56"
]
}]
});
const [lightOptions] = useState({
plugins: {
legend: {
labels: {
color: '#495057'
}
}
}
});
return (
<div className="card flex justify-content-center">
<Chart type="doughnut" 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.