11<script setup lang="ts">
22import VueApexCharts from ' vue3-apexcharts'
3- import { reactive } from ' vue '
3+
44import { storeToRefs } from ' pinia'
55import { useSettingsStore } from ' @/pinia'
66import type { Series } from ' @/components/Chart/types'
77
8- const { series, centerText, colors, name, bottomText }
9- = defineProps <{
10- series: Series [] | number []
11- centerText? : string
12- colors? : string
13- name? : string
14- bottomText? : string
15- }>()
8+ const props = defineProps <{
9+ series: Series [] | number []
10+ centerText? : string
11+ colors? : string
12+ name? : string
13+ bottomText? : string
14+ }>()
1615
1716const settings = useSettingsStore ()
1817
1918const { theme } = storeToRefs (settings )
2019
21- const chartOptions = reactive ({
22- series ,
20+ const fontColor = () => {
21+ return theme .value === ' dark' ? ' #fcfcfc' : undefined
22+ }
23+
24+ const chartOptions = computed (() => ({
25+ series: props .series ,
2326 chart: {
2427 type: ' radialBar' ,
2528 offsetY: 0 ,
@@ -31,24 +34,24 @@ const chartOptions = reactive({
3134 dataLabels: {
3235 name: {
3336 fontSize: ' 14px' ,
34- color: colors ,
37+ color: props . colors ,
3538 offsetY: 36 ,
3639 },
3740 value: {
38- offsetY: 50 ,
41+ offsetY: - 12 ,
3942 fontSize: ' 14px' ,
40- color: undefined ,
43+ color: fontColor () ,
4144 formatter : () => {
42- return ' '
45+ return props . centerText
4346 },
4447 },
4548 },
4649 },
4750 },
4851 fill: {
49- colors ,
52+ colors: props . colors ,
5053 },
51- labels: [name ],
54+ labels: [props . name ],
5255 states: {
5356 hover: {
5457 filter: {
@@ -61,7 +64,7 @@ const chartOptions = reactive({
6164 },
6265 },
6366 },
64- })
67+ }))
6568 </script >
6669
6770<template >
@@ -70,9 +73,6 @@ const chartOptions = reactive({
7073 :key =" theme"
7174 class =" radial-bar-container"
7275 >
73- <p class =" text" >
74- {{ centerText }}
75- </p >
7676 <p class =" bottom_text" >
7777 {{ bottomText }}
7878 </p >
@@ -96,6 +96,9 @@ const chartOptions = reactive({
9696 .radialBar {
9797 position : absolute ;
9898 top : -30px ;
99+ @media (max-width : 1700px ) and (min-width : 1200px ) {
100+ top : -10px ;
101+ }
99102 @media (max-width : 768px ) and (min-width : 290px ) {
100103 left : 50% ;
101104 transform : translateX (-50% );
@@ -104,14 +107,16 @@ const chartOptions = reactive({
104107
105108 .text {
106109 position : absolute ;
107- top : calc (50% - 5px );
108110 width : 100% ;
109111 text-align : center ;
110112 }
111113
112114 .bottom_text {
113115 position : absolute ;
114116 top : calc (106px );
117+ @media (max-width : 1300px ) and (min-width : 1200px ) {
118+ top : calc (96px );
119+ }
115120 font-weight : 600 ;
116121 width : 100% ;
117122 text-align : center ;
0 commit comments