diff --git a/src/pages/statistics/ChartContainer.tsx b/src/pages/statistics/ChartContainer.tsx index deb32b0..4485e1b 100644 --- a/src/pages/statistics/ChartContainer.tsx +++ b/src/pages/statistics/ChartContainer.tsx @@ -219,11 +219,17 @@ const ChartContainer = () => { color: palette.common.white, labels: { title: { - formatter: (val: any, ctx: any) => - `${ctx.chart.data.labels[ctx.dataIndex]}\n`, - font: { - fontWeight: 'bold', - size: 17, + formatter: (val: any, ctx: any) => { + const percentage = Math.round((val * 100) / (totalSum || 100)); + return percentage > 7 + ? `${ctx.chart.data.labels[ctx.dataIndex]}\n` + : '..'; + }, + font: () => { + return { + fontWeight: 'bold', + size: 16, + }; }, }, value: { @@ -231,10 +237,12 @@ const ChartContainer = () => { if (!totalSum) { return ''; } - return `\n${Math.round((val * 100) / (totalSum || 100))}%`; + const percentage = Math.round((val * 100) / (totalSum || 100)); + return percentage > 7 ? `\n${percentage}%` : ''; }, font: { - size: 14, + fontWeight: 'bold', + size: 12, }, }, }, @@ -285,12 +293,17 @@ const ChartContainer = () => { formatter: (val: number) => { const time = timeFormatter(val); return ( - `${time.hour}시간` + (time.minute ? `\n ${time.minute}분` : '') + `${time.hour}시간` + + (time.hour.toString().length > 2 + ? '' + : time.minute + ? `\n ${time.minute}분` + : '\n ') ); }, font: { weight: 'bold', - size: 14, + size: 12, }, }, }, @@ -415,18 +428,17 @@ const ChartContainer = () => { key={idx} sx={{ display: 'flex', - height: '9.5vh', - margin: '0 17px', + m: '10px 17px', + p: 0, }} > { } setCategorySum( () => - (subCategoryData ?? statisticsResult - )?.reduce( + (subCategoryData ?? statisticsResult)?.reduce( (accu: number, curr: StatisticsDetail) => accu + curr.timeSum, 0, @@ -548,7 +559,9 @@ const ChartContainer = () => { return ( <> - + { )} - {setCategoryDetailDataList( - totalSum ? categoryDetailData : statisticsResult, - )} + + {setCategoryDetailDataList( + totalSum ? categoryDetailData : statisticsResult, + )} + ); }; diff --git a/src/pages/statistics/StatisticsPage.tsx b/src/pages/statistics/StatisticsPage.tsx index 17b851a..c792c11 100644 --- a/src/pages/statistics/StatisticsPage.tsx +++ b/src/pages/statistics/StatisticsPage.tsx @@ -6,6 +6,8 @@ import ChartContainer from '@/pages/statistics/ChartContainer'; import { bottomNavigation } from '@/store/common'; import { useEffect } from 'react'; import { useSetRecoilState } from 'recoil'; +import Wrapper from '../auth/common/Wrapper'; +import { Box } from '@mui/material'; const StatisticsPage = () => { const setNavPage = useSetRecoilState(bottomNavigation); @@ -15,11 +17,21 @@ const StatisticsPage = () => { }, []); return ( - <> - - - - + } + > + + + + + ); };