index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <!--
  2. 描述: 多彩雷达
  3. 作者: Jack Chen
  4. 日期: 2020-05-02
  5. -->
  6. <template>
  7. <div class="wrap-container sn-container">
  8. <div class="sn-content">
  9. <div class="sn-title">多彩雷达</div>
  10. <div class="sn-body">
  11. <div class="wrap-container">
  12. <div class="chartsdom" id="chart_radar"></div>
  13. </div>
  14. </div>
  15. </div>
  16. </div>
  17. </template>
  18. <script>
  19. export default {
  20. name: `colorfulRadar`,
  21. data() {
  22. return {
  23. option: null,
  24. }
  25. },
  26. mounted() {
  27. this.getEchart()
  28. },
  29. methods: {
  30. getEchart() {
  31. let myChart = echarts.init(document.getElementById(`chart_radar`))
  32. this.option = {
  33. tooltip: {
  34. trigger: `axis`,
  35. },
  36. radar: [
  37. {
  38. indicator: [
  39. { text: `外观`, max: 100 },
  40. { text: `拍照`, max: 100 },
  41. { text: `系统`, max: 100 },
  42. { text: `性能`, max: 100 },
  43. { text: `屏幕`, max: 100 },
  44. { text: `折叠`, max: 100 },
  45. ],
  46. radius: `75%`,
  47. center: [`50%`, `50%`],
  48. name: {
  49. textStyle: {
  50. color: `#1883ff`,
  51. },
  52. },
  53. axisTick: {
  54. show: false,
  55. },
  56. axisLabel: {
  57. show: false,
  58. },
  59. axisLine: {
  60. show: true,
  61. symbol: `arrow`,
  62. symbolSize: [5, 7.5],
  63. lineStyle: {
  64. color: `#1883ff`,
  65. type: `dashed`,
  66. },
  67. },
  68. splitArea: {
  69. show: false,
  70. },
  71. splitLine: {
  72. show: false,
  73. },
  74. },
  75. ],
  76. series: [
  77. {
  78. type: `radar`,
  79. areaStyle: {},
  80. symbol: `none`,
  81. itemStyle: {
  82. normal: {
  83. areaStyle: {
  84. type: `default`,
  85. },
  86. },
  87. },
  88. lineStyle: {
  89. opacity: 0,
  90. },
  91. data: [
  92. {
  93. value: [35, 50, 30, 30, 40, 45],
  94. name: `智能手机`,
  95. itemStyle: {
  96. normal: {
  97. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  98. {
  99. offset: 0,
  100. color: `#9c6b4e`,
  101. },
  102. {
  103. offset: 1,
  104. color: `#2a59ac`,
  105. },
  106. ]),
  107. lineStyle: {
  108. color: `#2a59ac`,
  109. },
  110. },
  111. },
  112. },
  113. {
  114. value: [70, 40, 55, 55, 30, 55],
  115. name: `5G手机`,
  116. itemStyle: {
  117. normal: {
  118. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  119. {
  120. offset: 0,
  121. color: `#0855ca`,
  122. },
  123. {
  124. offset: 1,
  125. color: `#36a6c7`,
  126. },
  127. ]),
  128. lineStyle: {
  129. color: `#36a6c7`,
  130. },
  131. },
  132. },
  133. },
  134. ],
  135. },
  136. ],
  137. }
  138. myChart.setOption(this.option, true)
  139. window.addEventListener(`resize`, () => {
  140. myChart.resize()
  141. })
  142. },
  143. },
  144. beforeDestroy() {},
  145. }
  146. </script>
  147. <style lang="scss" scoped>
  148. .sn-container {
  149. left: 1436px;
  150. top: 1978px;
  151. width: 432px;
  152. height: 400px;
  153. .chartsdom {
  154. width: 100%;
  155. height: 100%;
  156. }
  157. }
  158. </style>