diff --git a/src/_components/boxChart/BoxDoughnutChar.js b/src/_components/boxChart/BoxDoughnutChar.js
index abc7f51..da02c47 100644
--- a/src/_components/boxChart/BoxDoughnutChar.js
+++ b/src/_components/boxChart/BoxDoughnutChar.js
@@ -5,7 +5,7 @@ import './boxChart.scss'
export default function BoxDoughnutChart({data = [], title, propsContainer}) {
const [current, target] = data
- const chartData = (current / target === 1 || current > target) ? [current] : [current, target - current];
+ // const chartData = (current / target === 1 || current > target) ? [current] : [current, target - current];
const renderStats = () => {
return (
@@ -21,7 +21,7 @@ export default function BoxDoughnutChart({data = [], title, propsContainer}) {
{title}
-
+
{renderStats()}
diff --git a/src/_components/chart/RDoughnutChart.js b/src/_components/chart/RDoughnutChart.js
index ea29a09..0cd9456 100644
--- a/src/_components/chart/RDoughnutChart.js
+++ b/src/_components/chart/RDoughnutChart.js
@@ -10,36 +10,44 @@ export default function RDoughnutChart({data = [], ...other}) {
return null
}
- // data = data.map((item, index) => {
- // if (index === 1 && item === 0) {
- // return 1
- // }
- // return item
- // })
- // console.log('data',data);
+ const total = data[1] === 0 ? 1 : data[0] + data[1];
+ const percentageData = [
+ (data[0] / total) * 100,
+ (data[1] / total) * 100,
+ ];
+
+ const adjustedData = (percentageData[0] === 0 && percentageData[1] === 0) || percentageData[1] === percentageData[0] ? [0, 1] : percentageData;
return {
- getDataOrganization()
- getDataStatisticCircle()
+ useEffect(async () => {
+ await getDataOrganization()
+ await getDataStatisticCircle()
}, [])
- useEffect(() => {
- getDataStudentChart()
+ useEffect(async () => {
+ await getDataStudentChart()
}, [dateStudentChart])
- useEffect(() => {
- getDataTeacherChart()
+ useEffect(async () => {
+ await getDataTeacherChart()
}, [dateTeacherChart])
const getDataTeacher = async () => {