RoseCon.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <div class="wrap-container sn-container">
  3. <div class="sn-content">
  4. <div class="sn-title">玫瑰图</div>
  5. <div class="sn-body">
  6. <div class="wrap-container">
  7. <div class="chart" id="chart_right2"></div>
  8. </div>
  9. </div>
  10. </div>
  11. </div>
  12. </template>
  13. <script>
  14. import screenfull from 'screenfull'
  15. export default {
  16. name: "RoseCon",
  17. data() {
  18. return {
  19. fullscreen: false
  20. }
  21. },
  22. mounted() {
  23. let myChart = echarts.init(document.getElementById('chart_right2'));
  24. this.getEchartRight2();
  25. window.addEventListener('resize', () => {
  26. myChart.resize()
  27. })
  28. },
  29. methods: {
  30. reload() {
  31. this.$router.go(0);
  32. },
  33. getEchartRight2() {
  34. let myChart = echarts.init(document.getElementById('chart_right2'));
  35. let option = {
  36. color: ['#EAEA26', '#906BF9', '#FE5656', '#01E17E', '#3DD1F9', '#FFAD05', '#4465fc'],
  37. toolbox: {
  38. feature: {
  39. mytool: {
  40. show: true,
  41. title: "全屏",
  42. icon: 'path://M181 357.5V181.2h176.4c14.3 0 25.9-11.6 25.9-25.9v-31.1c0-14.3-11.6-25.9-25.9-25.9H118c-11 0-20 9-20 20v239.4c0 14.3 11.6 25.9 25.9 25.9H155c14.4-0.1 26-11.7 26-26.1zM668.6 181.2H845v176.4c0 14.3 11.6 25.9 25.9 25.9H902c14.3 0 25.9-11.6 25.9-25.9V118.2c0-11-9-20-20-20H668.6c-14.3 0-25.9 11.6-25.9 25.9v31.1c0 14.3 11.6 26 25.9 26zM357.4 845.2H181V668.8c0-14.3-11.6-25.9-25.9-25.9H124c-14.3 0-25.9 11.6-25.9 25.9v239.4c0 11 9 20 20 20h239.4c14.3 0 25.9-11.6 25.9-25.9v-31.1c-0.1-14.4-11.7-26-26-26zM845 668.8v176.4H668.6c-14.3 0-25.9 11.6-25.9 25.9v31.1c0 14.3 11.6 25.9 25.9 25.9H908c11 0 20-9 20-20V668.8c0-14.3-11.6-25.9-25.9-25.9H871c-14.4 0-26 11.6-26 25.9z',
  43. onclick: function () {
  44. const element = document.getElementById('chart_right2');
  45. if (!screenfull.isEnabled) {//判断是否支持全屏
  46. this.$message({
  47. message: '您的浏览器暂时不支持全屏切换',
  48. type: 'warning'
  49. })
  50. return false
  51. }
  52. screenfull.toggle(element)
  53. },
  54. }
  55. },
  56. },
  57. tooltip: {
  58. trigger: 'item',
  59. formatter: '{b} : {c} ({d}%)'
  60. },
  61. polar: {},
  62. angleAxis: {
  63. interval: 1,
  64. type: 'category',
  65. data: [],
  66. z: 10,
  67. axisLine: {
  68. show: false,
  69. lineStyle: {
  70. color: '#0B4A6B',
  71. width: 5,
  72. type: 'solid'
  73. },
  74. },
  75. axisLabel: {
  76. interval: 0,
  77. show: true,
  78. color: '#0B4A6B',
  79. margin: 8,
  80. fontSize: 16
  81. },
  82. },
  83. radiusAxis: {
  84. min: 40,
  85. max: 120,
  86. interval: 20,
  87. axisLine: {
  88. show: false,
  89. lineStyle: {
  90. color: '#0B3E5E',
  91. width: 1,
  92. type: 'solid'
  93. },
  94. },
  95. axisLabel: {
  96. formatter: '{value} %',
  97. show: false,
  98. padding: [0, 0, 20, 0],
  99. color: '#0B3E5E',
  100. fontSize: 16
  101. },
  102. splitLine: {
  103. lineStyle: {
  104. color: '#0B3E5E',
  105. width: 2,
  106. type: "solid"
  107. }
  108. }
  109. },
  110. calculable: true,
  111. series: [{
  112. type: 'pie',
  113. radius: ['6%', '10%'],
  114. hoverAnimation: false,
  115. labelLine: {
  116. normal: {
  117. show: false,
  118. length: 30,
  119. length2: 50
  120. },
  121. emphasis: {
  122. show: false
  123. }
  124. },
  125. tooltip: {
  126. show: false
  127. },
  128. data: [{
  129. name: '',
  130. value: 0,
  131. itemStyle: {
  132. normal: {
  133. color: '#0B4A6B'
  134. }
  135. }
  136. }]
  137. }, {
  138. type: 'pie',
  139. radius: ['90%', '95%'],
  140. hoverAnimation: false,
  141. labelLine: {
  142. normal: {
  143. show: false,
  144. length: 30,
  145. length2: 50
  146. },
  147. emphasis: {
  148. show: false
  149. }
  150. },
  151. tooltip: {
  152. show: false
  153. },
  154. data: [{
  155. name: '',
  156. value: 0,
  157. itemStyle: {
  158. normal: {
  159. color: '#0B4A6B'
  160. }
  161. }
  162. }]
  163. },{
  164. stack: 'a',
  165. type: 'pie',
  166. radius: ['20%', '80%'],
  167. roseType: 'area',
  168. zlevel: 10,
  169. label: {
  170. normal: {
  171. show: true,
  172. formatter: '{b}',
  173. textStyle: {
  174. fontSize: 12,
  175. },
  176. position: 'outside'
  177. },
  178. emphasis: {
  179. show: false
  180. }
  181. },
  182. labelLine: {
  183. normal: {
  184. show: true,
  185. length: 15,
  186. length2: 50,
  187. lineStyle: {
  188. type: 'dotted'
  189. }
  190. },
  191. emphasis: {
  192. show: true
  193. }
  194. },
  195. data: [{
  196. value: 1173,
  197. name: '香港'
  198. },{
  199. value: 131,
  200. name: '台湾'
  201. },{
  202. value: 108,
  203. name: '上海'
  204. },{
  205. value: 41,
  206. name: '广东'
  207. },{
  208. value: 36,
  209. name: '四川'
  210. },{
  211. value: 22,
  212. name: '福建'
  213. },{
  214. value: 20,
  215. name: '内蒙古'
  216. }]
  217. }]
  218. }
  219. myChart.setOption(option, true);
  220. window.addEventListener('resize', () => {
  221. // myChart.resize();
  222. });
  223. },
  224. },
  225. beforeDestroy() {
  226. }
  227. };
  228. </script>
  229. <style lang="scss" scoped>
  230. .sn-container {
  231. width: 99%;
  232. height: 99%;
  233. //position: relative;
  234. .chart {
  235. height: 90%;
  236. width: 90%;
  237. margin-bottom: 1%;
  238. margin-left: 7%;
  239. }
  240. }
  241. </style>