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
| <template>
| <div class="echart36_box">
| <div id="echart36"></div>
| </div>
| </template>
|
| <script>
| export default {
| //import引入的组件需要注入到对象中才能使用
| components: {},
| data() {
| //这里存放数据
| return { myChart:null};
| },
| mounted() {
| this.lineChart();
| this.$bus.$on('resizeEchart', (res) => {
| this.myChart.resize();
| });
| },
| //方法集合
| methods: {
| lineChart() {
| let option = {
| title: {
| text: '各项目人员分配',
| top:15,
| textStyle: {
| color: '#fff',
| },
| },
| tooltip: {
| trigger: 'item',
| },
| visualMap: {
| show: false,
| min: 0,
| max: 90,
| inRange: {
| colorLightness: [0, 1],
| },
| },
| series: [
| {
| name: '各项目人员分配',
| type: 'pie',
| radius: '55%',
| center: ['50%', '50%'],
| data: [
| { value: 80, name: '中俄东线管道工程南段' },
| { value: 70, name: '中俄东线管道工程中段' },
| { value: 15, name: '广州站' },
| { value: 30, name: '唐山LNG' },
| { value: 15, name: '新疆连木沁站场' },
| { value: 35, name: '中缅天然气管道风险排查航空摄影测量' },
| ].sort(function (a, b) {
| return a.value - b.value;
| }),
| roseType: 'radius',
| label: {
| color: 'rgba(255, 255, 255, 0.8)',
| },
| labelLine: {
| lineStyle: {
| color: 'rgba(255, 255, 255, 0.8)',
| },
| smooth: 0.2,
| length: 10,
| length2: 20,
| },
| itemStyle: {
| color: '#c23531',
| shadowBlur: 200,
| shadowColor: 'rgba(0, 0, 0, 0.5)',
| },
| animationType: 'scale',
| animationEasing: 'elasticOut',
| animationDelay: function (idx) {
| return Math.random() * 200;
| },
| },
| ],
| };
| this.myChart = this.$echarts.init(document.getElementById('echart36'));
| this.myChart.setOption(option);
| window.addEventListener('resize', function () {
| this.myChart.resize();
| });
| },
| },
| created() {},
| };
| </script>
| <style lang="less" scoped>
| //@import url(); 引入公共css类
| .echart36_box {
| padding: 20px;
| width: 100%;
| height: 100%;
| }
| #echart36 {
| width: calc(100% - 40px);
| height: calc(100% - 40px);
| }
| </style>
|
|