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
| <template>
| <div class="echart44_box">
| <div id="echart44"></div>
| </div>
| </template>
|
| <script>
| export default {
| //import引入的组件需要注入到对象中才能使用
| components: {},
| data() {
| //这里存放数据
| return { myChart };
| },
| mounted() {
| this.lineChart();
| this.$bus.$on('resizeEchart', (res) => {
| this.myChart.resize();
| });
| },
| //方法集合
| methods: {
| lineChart() {
| let option = {
| title: {
| text: '各项目总体进度',
| textStyle: {
| color: '#fff',
| },
| },
| tooltip: {
| trigger: 'item',
| },
| // legend: {},
| grid: {
| left: '3%',
| right: '4%',
| bottom: '3%',
| containLabel: true,
| },
| series: [
| {
| name: '各项目总体进度',
| type: 'pie',
| radius: ['40%', '70%'],
| roseType: 'radius',
| color: ['#03effb', '#00bec4', '#3a82ab'],
| avoidLabelOverlap: false,
| itemStyle: {
| fontColor: 'fff',
| borderColor: '#fff',
| },
| label: {
| show: false,
| position: 'center',
| },
| emphasis: {
| // label: {
| // show: true,
| // fontSize: "18",
| // },
| },
| labelLine: {
| show: false,
| },
| data: [
| { value: 4, name: '已完成' },
| { value: 7, name: '进行中' },
| { value: 8, name: '未开始' },
| ],
| },
| ],
| };
| this.myChart = this.$echarts.init(document.getElementById('echart44'));
| this.myChart.setOption(option);
| window.addEventListener('resize', function () {
| this.myChart.resize();
| });
| },
| },
| created() {},
| };
| </script>
| <style lang="less" scoped>
| //@import url(); 引入公共css类
| .echart44_box {
| padding: 20px;
| // background: rgba(0, 0, 0, 0.6);
| }
| #echart44 {
| width: 100%;
| height: 100%;
| }
| </style>
|
|