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
| <template>
| <div class="charts-container">
| <div id="typePie"></div>
| </div>
| </template>
| <script setup>
| import * as echarts from 'echarts';
| import {onMounted} from "vue";
|
| onMounted(()=>{
| initChart()
| })
|
| const initChart =()=>{
| var chartDom = document.getElementById('typePie');
| var myChart = echarts.init(chartDom);
| var option;
|
| option = {
| tooltip: {
| trigger: 'item',
| formatter: '{a} <br/>{b} : {c} ({d}%)'
| },
| legend: {
| left: 'center',
| bottom: '0',
| textStyle: {
| color: 'rgba(255,255,255,.6)'
| }
| },
| textStyle:{
| textBorderWidth: 0,
| },
| series: [
| {
| type: 'pie',
| radius: [20, 100],
| center: ['50%', '45%'],
| roseType: 'area',
| itemStyle: {
| borderRadius: 5
| },
| label: {
| color: '#fff',
| textBorderWidth: 0,
| formatter: '{d}%'
| },
| data: [
| { value: 30, name: 'rose 1' },
| { value: 28, name: 'rose 2' },
| { value: 26, name: 'rose 3' },
| { value: 24, name: 'rose 4' },
| { value: 22, name: 'rose 5' },
| { value: 20, name: 'rose 6' },
| { value: 18, name: 'rose 7' },
| { value: 16, name: 'rose 8' }
| ]
| }
| ]
| };
|
| option && myChart.setOption(option);
| }
|
| </script>
|
| <style lang="postcss" scoped>
| .charts-container{
| width: 100%;
| height: 100%;
| }
|
| #typePie{
| width: 100%;
| height: 100%;
| }
| </style>
|
|