CardWidgetsTotalRevenue.vue
3.16 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<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 secondaryTextColor = `rgba(${hexToRgb(currentTheme.value['on-surface'])},${variableTheme.value['medium-emphasis-opacity']})`
const primaryTextColor = `rgba(${hexToRgb(currentTheme.value['on-surface'])},${variableTheme.value['high-emphasis-opacity']})`
return {
chart: { sparkline: { enabled: true } },
labels: ['Returning', 'New Users', 'Referrals'],
legend: { show: false },
stroke: { lineCap: 'round' },
colors: ['rgba(var(--v-theme-primary),1)', currentTheme.value.success, currentTheme.value.warning],
states: {
hover: { filter: { type: 'none' } },
active: { filter: { type: 'none' } },
},
plotOptions: {
radialBar: {
hollow: { size: '40%' },
track: {
background: 'transparent',
margin: 10,
},
dataLabels: {
name: {
offsetY: 28,
color: secondaryTextColor,
},
value: {
fontSize: '1.75rem',
offsetY: -12,
color: primaryTextColor,
formatter(value: unknown) {
return `${value}k`
},
},
total: {
show: true,
label: `${new Date().getFullYear()}`,
color: secondaryTextColor,
fontSize: '13px',
fontWeight: 400,
formatter(value: { globals: { seriesTotals: any[] } }) {
return `${value.globals.seriesTotals.reduce((total: number, num: number) => total + num)}k`
},
},
},
},
},
}
})
const series = [71, 78, 86]
const revenueData = [
{ title: 'New User', value: 856, color: 'success' },
{ title: 'Returning', value: 345, color: 'primary' },
{ title: 'Referrals', value: 258, color: 'warning' },
]
</script>
<template>
<VCard>
<VCardItem>
<VCardTitle>Total Revenue</VCardTitle>
<template #append>
<div class="me-n3">
<MoreBtn />
</div>
</template>
</VCardItem>
<VCardText>
<VueApexCharts
type="radialBar"
:options="options"
:series="series"
:height="243"
/>
<div class="d-flex justify-space-around mt-4">
<template
v-for="(item, index) in revenueData"
:key="index"
>
<div>
<div class="d-flex align-center">
<VIcon
size="10"
:color="item.color"
icon="ri-circle-fill"
class="me-2"
/>
<h6 class="text-h6">
{{ item.value }}
</h6>
</div>
<div class="text-base">
{{ item.title }}
</div>
</div>
<VDivider
v-if="index !== revenueData.length - 1"
vertical
/>
</template>
</div>
</VCardText>
</VCard>
</template>