CardWidgetsTotalProfitRadialBar.vue
1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<script setup lang="ts">
import { useTheme } from 'vuetify'
import { hexToRgb } from '@core/utils/colorConverter'
const vuetifyTheme = useTheme()
const options = computed(() => {
const currentTheme = ref(vuetifyTheme.current.value.colors)
const variableTheme = ref(vuetifyTheme.current.value.variables)
const primaryTextColor = `rgba(${hexToRgb(currentTheme.value['on-surface'])},${variableTheme.value['high-emphasis-opacity']})`
return {
chart: {
sparkline: { enabled: true },
},
stroke: { dashArray: 5 },
colors: ['rgba(var(--v-theme-primary),1)'],
states: {
hover: {
filter: { type: 'none' },
},
active: {
filter: { type: 'none' },
},
},
plotOptions: {
radialBar: {
endAngle: 90,
startAngle: -90,
hollow: { size: '55%' },
track: { background: currentTheme.value['track-bg'] },
dataLabels: {
name: { show: false },
value: {
offsetY: -5,
fontSize: '18px',
fontWeight: 500,
color: primaryTextColor,
formatter: (val: number) => {
const num = (val * 35250) / 100
return num > 999 ? `${(num / 1000).toFixed(1)}k` : `${num}`
},
},
},
},
},
}
})
const series = [80]
</script>
<template>
<VCard>
<VCardItem>
<VCardTitle>Total Profit</VCardTitle>
<template #append>
<div class="me-n3">
<MoreBtn />
</div>
</template>
</VCardItem>
<VueApexCharts
type="radialBar"
:options="options"
:series="series"
/>
<VCardText class="text-center">
<div class="mt-5">
<p class="text-body-1 mb-2">
18k new sales
</p>
<VChip
color="primary"
size="small"
>
This Year
</VChip>
</div>
</VCardText>
</VCard>
</template>