generated from antfu-collective/vitesse
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DonutChart.vue
117 lines (111 loc) · 2.06 KB
/
DonutChart.vue
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
<script setup lang="ts">
import VueApexCharts from 'vue3-apexcharts'
import { ref } from 'vue'
const donutChartOptions = ref({
chart: {
type: 'donut',
toolbar: {
show: false,
},
},
dataLabels: {
enabled: false,
},
legend: {
show: false,
position: 'right',
offsetX: -30,
offsetY: 20,
formatter: (value: any, opts: any): any => {
return `${value} - ${opts.w.globals.series[opts.seriesIndex]}`
},
markers: {
onClick: undefined,
offsetX: 0,
offsetY: 25,
},
},
labels: ['Tech', 'Cloth', 'HH', 'Food'],
stroke: {
width: 0,
show: true,
curve: 'smooth',
lineCap: 'round',
},
colors: ['var(--primary-color)', 'var(--primary-color-shade1)', 'var(--primary-color-shade2)', 'var(--primary-color-shade3)'],
grid: {
padding: {
right: -20,
bottom: -8,
left: -20,
},
},
plotOptions: {
pie: {
borderRadius: 10,
startAngle: -20,
donut: {
borderRadius: 10,
labels: {
show: true,
name: {
offsetY: 15,
},
value: {
offsetY: -15,
formatter(t: string): any {
return ''.concat(Number.parseInt(t).toString(), '%')
},
},
total: {
show: true,
offsetY: 15,
label: 'App',
formatter() {
return '53%'
},
},
},
},
},
},
responsive: [{
breakpoint: 1325,
options: {
chart: {
height: 100,
},
},
}, {
breakpoint: 1200,
options: {
chart: {
height: 120,
},
},
}, {
breakpoint: 1045,
options: {
chart: {
height: 100,
},
},
}, {
breakpoint: 992,
options: {
chart: {
height: 120,
},
},
}],
},
)
const donutSeries = ref(
[30, 40, 20, 10],
)
</script>
<template>
<VueApexCharts :series="donutSeries" height="180" :options="donutChartOptions" />
</template>
<style lang="scss" scoped>
</style>