forked from HoangLaoTa/gk_se_web_report
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
977 B
39 lines
977 B
import React from 'react';
|
|
import { Chart } from 'react-chartjs-2';
|
|
import { PRIMARY_COLOR } from '../../_constants/common';
|
|
import { Chart as ChartJS, registerables } from 'chart.js';
|
|
|
|
ChartJS.register(...registerables);
|
|
|
|
export default function RDoughnutChart({data = [], ...other}) {
|
|
if (!data?.length) {
|
|
return null
|
|
}
|
|
|
|
return <Chart
|
|
type='doughnut'
|
|
data={{
|
|
labels: [],
|
|
datasets: [
|
|
{
|
|
label: '',
|
|
data,
|
|
backgroundColor: [
|
|
PRIMARY_COLOR, '#01AEF0'
|
|
],
|
|
borderWidth: 0
|
|
},
|
|
],
|
|
}}
|
|
options={{
|
|
responsive: true,
|
|
maintainAspectRatio: false,
|
|
plugins: {
|
|
tooltip: {
|
|
enabled: false
|
|
}
|
|
}
|
|
}}
|
|
{...other}
|
|
/>;
|
|
}
|
|
|