王飞
2025-01-23 b108c63ceb09716fb04a62cc155a404b236b6794
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<!--
 描述: 多彩雷达
 作者: Jack Chen
 日期: 2020-05-02
-->
 
<template>
  <div class="wrap-container sn-container"> 
    <div class="sn-content"> 
      <div class="sn-title">多彩雷达</div> 
      <div class="sn-body"> 
        <div class="wrap-container"> 
          <div class="chartsdom" id="chart_radar"></div> 
        </div> 
      </div> 
    </div>   
  </div>
</template>
 
<script>
export default {
  name: "colorfulRadar",
  data() {
    return {
      option: null
      
    }
  },
  mounted() {
    this.getEchart();
  },
  methods: {
    getEchart() {
      let myChart = echarts.init(document.getElementById('chart_radar'));
      this.option = {
        tooltip: {
          trigger: 'axis'
        },
        radar: [{
          indicator: [
            {text: '外观', max: 100},
            {text: '拍照', max: 100},
            {text: '系统', max: 100},
            {text: '性能', max: 100},
            {text: '屏幕', max: 100},
            {text: '折叠', max: 100}
          ],
          radius: '75%',
          center: ['50%', '50%'],
          name: {
            textStyle: {
              color: '#1883ff'
            }
          },
          axisTick: {
            show: false
          },
          axisLabel: {
            show: false
          },
          axisLine: {
            show: true,
            symbol: 'arrow',
            symbolSize: [5, 7.5],
            lineStyle: {
              color: '#1883ff',
              type: 'dashed'
            }
          },
          splitArea: {
            show: false
          },
          splitLine: {
            show: false
          }
        }],
        series: [{
          type: 'radar',
          areaStyle: {},
          symbol: 'none',
          itemStyle: {
            normal: {
              areaStyle: {
                type: 'default'
              }
            }
          },
          lineStyle: {
            opacity: 0,
          },
          data: [{
            value: [35, 50, 30, 30, 40, 45],
            name: '智能手机',
            itemStyle: {
              normal: {
                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                  offset: 0, 
                  color: '#9c6b4e'
                },{
                  offset: 1, 
                  color: '#2a59ac'
                }]),
                lineStyle: {
                  color: '#2a59ac'
                }
              }
            }
          },
          {
            value: [70, 40, 55, 55, 30, 55],
            name: '5G手机',
            itemStyle: {
              normal: {
                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                  offset: 0, 
                  color: '#0855ca'
                },{
                  offset: 1, 
                  color: '#36a6c7'
                }]),
                lineStyle: {
                  color: '#36a6c7'
                }
              }
            }
          }]
        }]
      }
 
      myChart.setOption(this.option, true);
 
      window.addEventListener('resize', () => {
        myChart.resize();
      });
    }
  },
  beforeDestroy() {
    
  }
};
</script>
 
<style lang="scss" scoped>
.sn-container {
  left: 1436px;
  top: 1978px;
  width: 432px;
  height: 400px;
  .chartsdom {
    width: 100%;
    height: 100%;
  }
}
</style>