SAradargraph.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <div class="radargraph_box">
  3. <!--<div class="bargraph_title"><p>各项科目表现</p></div>-->
  4. <div id="myChart_lei" :style="{width: '100%', height: '450px'}"></div>
  5. </div>
  6. </template>
  7. <script>
  8. export default {
  9. name: "radargraph",
  10. data(){
  11. return{
  12. }
  13. },
  14. created() {
  15. this.init();
  16. },
  17. computed:{
  18. // 命令发布监听
  19. //mode () {
  20. // return this.$store.state.leida.mode
  21. //},
  22. leida () {
  23. return this.$store.state.leida
  24. },
  25. },
  26. methods:{
  27. drawLine(obj) {
  28. this.$store.state.leida.mode = false;
  29. let myChart_lei = this.$echarts.init(document.getElementById('myChart_lei'));
  30. myChart_lei.setOption({
  31. title: {
  32. text: '各项科目表现'
  33. },
  34. tooltip: {},
  35. legend: {
  36. top: 25,
  37. itemWidth: 16,
  38. itemHeight: 16,
  39. data: obj.titledata,
  40. textStyle: {
  41. color: '#000'
  42. }
  43. },
  44. radar: {
  45. radius: '60%',
  46. splitNumber: 8,
  47. axisLine: {
  48. lineStyle: {
  49. color: '#000',
  50. opacity: .2
  51. }
  52. },
  53. splitLine: {
  54. lineStyle: {
  55. color: '#fff',
  56. opacity: .2
  57. }
  58. },
  59. splitArea: {
  60. areaStyle: {
  61. color: 'rgba(127,95,132,.2)',
  62. opacity: 1,
  63. shadowBlur: 45,
  64. shadowColor: 'rgba(0,0,0,.5)',
  65. shadowOffsetX: 0,
  66. shadowOffsetY: 15,
  67. }
  68. },
  69. indicator: obj.indicator
  70. },
  71. series: [{
  72. name: obj.dataname,
  73. type: 'radar',
  74. symbolSize: 0,
  75. areaStyle: {
  76. normal: {
  77. shadowBlur: 13,
  78. shadowColor: 'rgba(0,0,0,.2)',
  79. shadowOffsetX: 0,
  80. shadowOffsetY: 10,
  81. opacity: 1
  82. }
  83. },
  84. data: [{
  85. value: obj.data1,
  86. name: obj.title_one,
  87. itemStyle: {
  88. color: 'rgba(239,75,76,.5)',
  89. lineStyle: {
  90. color: 'rgba(239,75,76,.5)',
  91. },
  92. }
  93. }, {
  94. value:obj.data2,
  95. name: obj.title_two,
  96. itemStyle: {
  97. color: 'rgba(177,234,219,.8)',
  98. lineStyle: {
  99. color: 'rgba(177,234,219,.8)',
  100. },
  101. }
  102. }]
  103. }],
  104. color: ['#ef4b4c', '#b1eadb'],
  105. backgroundColor: {
  106. type: 'radial',
  107. x: 0.4,
  108. y: 0.4,
  109. r: 0.35,
  110. colorStops: [{
  111. offset: 0,
  112. color: '#D4CED5' // 0% 处的颜色
  113. }, {
  114. offset: .4,
  115. color: '#f5f5f5' // 100% 处的颜色
  116. }, {
  117. offset: 1,
  118. color: '#fff' // 100% 处的颜色
  119. }],
  120. }
  121. });
  122. },
  123. init() {
  124. this.$api.FindRadargraph({})
  125. .then((response) => {
  126. //console.log(response.result,456);
  127. this.$store.state.leida=response.result.data
  128. //this.drawLine(response.result.data)
  129. //console.log(this.$store.state.zhuzhuang,33333344)
  130. })
  131. }
  132. },
  133. watch:{
  134. // 监听指令
  135. leida(a){
  136. if(a){
  137. this.drawLine(a)
  138. }
  139. },
  140. }
  141. }
  142. </script>