11<template >
2- <Pie
3- v-if =" labels.length !== 0"
4- :data =" teamData"
5- :options =" options" />
6- <NoContent
7- v-else
8- :content ="
9- !content && periodType ? `집계된 ${periodText[periodType]} 데이터가 없습니다` : content
10- " />
2+ <div class =" w-full h-full flex items-center justify-center" >
3+ <Pie
4+ v-if =" labels.length !== 0"
5+ :data =" teamData"
6+ :options =" options" />
7+ <NoContent
8+ v-else-if =" !isPending && labels.length === 0"
9+ :content ="
10+ !content && periodType
11+ ? `지난 ${periodText[periodType]}간 집계된\n데이터가 없습니다`
12+ : content
13+ " />
14+ </div >
1115</template >
1216
1317<script setup lang="ts">
@@ -26,15 +30,19 @@ import type { PeriodType } from '@/types/manager'
2630import NoContent from ' ../lists/NoContent.vue'
2731ChartJS .register (Title , Tooltip , Legend , ArcElement , Colors )
2832
29- const { labels, series, periodType, content } = defineProps <{
33+ const { labels, series, periodType, content, isPending, noLegend, title, position } = defineProps <{
3034 labels: string []
3135 series: number []
3236 periodType? : PeriodType
3337 content? : string
38+ isPending? : boolean
39+ noLegend? : boolean
40+ title? : string
41+ position? : ' top'
3442}>()
3543const emit = defineEmits ([' onClick' ])
3644
37- const periodText = { DAY: ' 일간 ' , WEEK: ' 주간 ' , MONTH: ' 월간 ' }
45+ const periodText = { DAY: ' 1일 ' , WEEK: ' 1주일 ' , MONTH: ' 1개월 ' }
3846
3947const teamData = {
4048 labels ,
@@ -53,6 +61,28 @@ const options = {
5361 const clickedIndex = elements [0 ].index
5462 emit (' onClick' , labels [clickedIndex ])
5563 }
64+ },
65+ hoverOffset: 10 ,
66+ plugins: {
67+ legend: {
68+ display: noLegend === true ? false : true ,
69+ position: position || (' left' as const )
70+ },
71+ tooltip: { enabled: true },
72+ title: {
73+ display: title ? true : false ,
74+ text: title ,
75+ font: { size: 12 , weight: 400 },
76+ color: ' #71717A'
77+ }
78+ },
79+ layout: {
80+ padding: {
81+ top: title ? 0 : 8 ,
82+ left: 8 ,
83+ right: 8 ,
84+ bottom: 8
85+ }
5686 }
5787}
5888 </script >
0 commit comments