|
@@ -1,25 +1,28 @@
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
import VueApexCharts from 'vue3-apexcharts'
|
|
import VueApexCharts from 'vue3-apexcharts'
|
|
-import { reactive } from 'vue'
|
|
|
|
|
|
+
|
|
import { storeToRefs } from 'pinia'
|
|
import { storeToRefs } from 'pinia'
|
|
import { useSettingsStore } from '@/pinia'
|
|
import { useSettingsStore } from '@/pinia'
|
|
import type { Series } from '@/components/Chart/types'
|
|
import type { Series } from '@/components/Chart/types'
|
|
|
|
|
|
-const { series, centerText, colors, name, bottomText }
|
|
|
|
- = defineProps<{
|
|
|
|
- series: Series[] | number[]
|
|
|
|
- centerText?: string
|
|
|
|
- colors?: string
|
|
|
|
- name?: string
|
|
|
|
- bottomText?: string
|
|
|
|
- }>()
|
|
|
|
|
|
+const props = defineProps<{
|
|
|
|
+ series: Series[] | number[]
|
|
|
|
+ centerText?: string
|
|
|
|
+ colors?: string
|
|
|
|
+ name?: string
|
|
|
|
+ bottomText?: string
|
|
|
|
+}>()
|
|
|
|
|
|
const settings = useSettingsStore()
|
|
const settings = useSettingsStore()
|
|
|
|
|
|
const { theme } = storeToRefs(settings)
|
|
const { theme } = storeToRefs(settings)
|
|
|
|
|
|
-const chartOptions = reactive({
|
|
|
|
- series,
|
|
|
|
|
|
+const fontColor = () => {
|
|
|
|
+ return theme.value === 'dark' ? '#fcfcfc' : undefined
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const chartOptions = computed(() => ({
|
|
|
|
+ series: props.series,
|
|
chart: {
|
|
chart: {
|
|
type: 'radialBar',
|
|
type: 'radialBar',
|
|
offsetY: 0,
|
|
offsetY: 0,
|
|
@@ -31,24 +34,24 @@ const chartOptions = reactive({
|
|
dataLabels: {
|
|
dataLabels: {
|
|
name: {
|
|
name: {
|
|
fontSize: '14px',
|
|
fontSize: '14px',
|
|
- color: colors,
|
|
|
|
|
|
+ color: props.colors,
|
|
offsetY: 36,
|
|
offsetY: 36,
|
|
},
|
|
},
|
|
value: {
|
|
value: {
|
|
- offsetY: 50,
|
|
|
|
|
|
+ offsetY: -12,
|
|
fontSize: '14px',
|
|
fontSize: '14px',
|
|
- color: undefined,
|
|
|
|
|
|
+ color: fontColor(),
|
|
formatter: () => {
|
|
formatter: () => {
|
|
- return ''
|
|
|
|
|
|
+ return props.centerText
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
fill: {
|
|
fill: {
|
|
- colors,
|
|
|
|
|
|
+ colors: props.colors,
|
|
},
|
|
},
|
|
- labels: [name],
|
|
|
|
|
|
+ labels: [props.name],
|
|
states: {
|
|
states: {
|
|
hover: {
|
|
hover: {
|
|
filter: {
|
|
filter: {
|
|
@@ -61,7 +64,7 @@ const chartOptions = reactive({
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
-})
|
|
|
|
|
|
+}))
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<template>
|
|
<template>
|
|
@@ -70,9 +73,6 @@ const chartOptions = reactive({
|
|
:key="theme"
|
|
:key="theme"
|
|
class="radial-bar-container"
|
|
class="radial-bar-container"
|
|
>
|
|
>
|
|
- <p class="text">
|
|
|
|
- {{ centerText }}
|
|
|
|
- </p>
|
|
|
|
<p class="bottom_text">
|
|
<p class="bottom_text">
|
|
{{ bottomText }}
|
|
{{ bottomText }}
|
|
</p>
|
|
</p>
|
|
@@ -96,6 +96,9 @@ const chartOptions = reactive({
|
|
.radialBar {
|
|
.radialBar {
|
|
position: absolute;
|
|
position: absolute;
|
|
top: -30px;
|
|
top: -30px;
|
|
|
|
+ @media (max-width: 1700px) and (min-width: 1200px) {
|
|
|
|
+ top: -10px;
|
|
|
|
+ }
|
|
@media (max-width: 768px) and (min-width: 290px) {
|
|
@media (max-width: 768px) and (min-width: 290px) {
|
|
left: 50%;
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
transform: translateX(-50%);
|
|
@@ -104,7 +107,6 @@ const chartOptions = reactive({
|
|
|
|
|
|
.text {
|
|
.text {
|
|
position: absolute;
|
|
position: absolute;
|
|
- top: calc(50% - 5px);
|
|
|
|
width: 100%;
|
|
width: 100%;
|
|
text-align: center;
|
|
text-align: center;
|
|
}
|
|
}
|
|
@@ -112,6 +114,9 @@ const chartOptions = reactive({
|
|
.bottom_text {
|
|
.bottom_text {
|
|
position: absolute;
|
|
position: absolute;
|
|
top: calc(106px);
|
|
top: calc(106px);
|
|
|
|
+ @media (max-width: 1300px) and (min-width: 1200px) {
|
|
|
|
+ top: calc(96px);
|
|
|
|
+ }
|
|
font-weight: 600;
|
|
font-weight: 600;
|
|
width: 100%;
|
|
width: 100%;
|
|
text-align: center;
|
|
text-align: center;
|