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
| <!-- 雷达图
|
| -->
| <script>
| import * as echarts from 'echarts';
| export default {
| props:{
| name:{
| type:Array,
| default:()=>{
| return []
| }
| },
| data:{
| type:Array,
| default:()=>{
| return []
| }
| }
| },
| data() {
| return {
| chart: null
| };
| },
| watch:{
| data(){
| this.set()
| }
| },
| mounted() {
| this.initRadarChart();
| },
| methods: {
| initRadarChart() {
| this.chart = echarts.init(document.getElementById('main'));
| },
| set(){
| let option = {
| title: {
| text: '基础分析'
| },
| tooltip: {},
| radar: {
| // shape: 'circle',
| indicator: [
| { name: this.name[0], max: 1 },
| { name: this.name[1], max: 1 },
| { name: this.name[2], max: 1 },
| { name: this.name[3], max: 1 },
| { name: this.name[4], max: 1 }
| ]
| },
| series: [
| {
| name: 'Budget vs spending',
| type: 'radar',
| data: [
| {
| value: [this.data[0]*0.01,this.data[1]*0.01, this.data[2]*0.01,this.data[3]*0.01,this.data[4]*0.01],
| name: '异常分析'
| },
| ]
| }
| ]
| };
| this.chart.setOption(option);
| }
| }
| };
| </script>
|
| <template>
| <div id="main" class="chart"></div>
| </template>
|
| <style scoped>
| .chart {
| width: 100%;
| height: 35vh;
| }
| </style>
|
|