chart-fireCause.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <!-- **************************************NO.4 隐患*************************************** -->
  2. <template>
  3. <div class="chart-container">
  4. <div id="danger" style="width: 100%; height:23vh;">
  5. </div>
  6. </div>
  7. </template>
  8. <script>
  9. import * as echarts from 'echarts';
  10. export default {
  11. name: 'danger',
  12. data() {
  13. return {
  14. count: 0
  15. }
  16. },
  17. mounted() {
  18. this.myEcharts()
  19. },
  20. methods: {
  21. // 出处 http://192.144.199.210:8080/editor/index.html?chart_id=XWNjkKJQ3NBt1FK6
  22. myEcharts() {
  23. var chartDom = document.getElementById('danger');
  24. var myChart = echarts.init(chartDom);
  25. var color = ['#02CDFF', '#62FBE7', '#7930FF', '#E148EB', '#ecb935']
  26. var option;
  27. let data = [582, 421, 622, 625, 265]
  28. let indicator = [{
  29. name: '双辽市',
  30. max: 1000
  31. },
  32. {
  33. name: '梨树县',
  34. max: 1000
  35. },
  36. {
  37. name: '伊通县',
  38. max: 1000
  39. },
  40. {
  41. name: '铁东区',
  42. max: 1000
  43. },
  44. {
  45. name: '铁西区',
  46. max: 1000
  47. },
  48. ]
  49. option = {
  50. radar: {
  51. center: ['50%', '50%'],
  52. radius: '89%',
  53. name: {
  54. formatter: function(name, indicator) {
  55. let arr;
  56. // if(name=='开卡绑定数'||name=='渠道批量办理业务'){
  57. // arr = [
  58. // '{a|'+name+'}{b|'+indicator.value+'万}'
  59. // ]
  60. // }else{
  61. arr = [
  62. '{a|' + name + '}'
  63. ]
  64. // }
  65. return arr.join('\n')
  66. },
  67. textStyle: {
  68. rich: { //根据文字的组设置格式
  69. a: {
  70. color: '#13ffdc',
  71. fontSize: 12,
  72. fontFamily: 'Source Han Sans CN',
  73. },
  74. // b:{
  75. // fontSize:14,
  76. // verticalAlign:'top',
  77. // width:57,
  78. // color:'#8E88FE',
  79. // fontWeight:600,
  80. // align:'center'
  81. // },
  82. }
  83. }
  84. },
  85. nameGap: 0,
  86. indicator: indicator,
  87. splitLine: {
  88. show: false
  89. },
  90. splitArea: {
  91. show: false
  92. },
  93. axisLine: {
  94. show: false
  95. }
  96. },
  97. series: [{
  98. // name: '家庭融合包',
  99. type: 'radar',
  100. data: [data],
  101. // value:14,
  102. label: {
  103. show: true,
  104. formatter: function(params) {
  105. console.log(params)
  106. return params.value ;
  107. },
  108. color: '#ffffff',
  109. // position:[-20,-10,-10,-10],
  110. align: 'right',
  111. distance: 10,
  112. align: 'right'
  113. },
  114. symbolSize: [6, 6],
  115. lineStyle: { //边缘颜色
  116. width: 0
  117. },
  118. itemStyle: {
  119. borderWidth: 1,
  120. color: '#fff',
  121. borderColor: '#F2F063',
  122. },
  123. areaStyle: {
  124. color: '#7D77F1',
  125. opacity: 0.6
  126. }
  127. },
  128. {
  129. type: 'radar',
  130. data: [
  131. [1000, 1000, 1000, 1000, 1000, 1000],
  132. ],
  133. symbol: 'none',
  134. lineStyle: {
  135. width: 0
  136. },
  137. itemStyle: {
  138. color: '#4175F5'
  139. },
  140. areaStyle: {
  141. color: '#4175F5',
  142. opacity: 0.06
  143. }
  144. },
  145. {
  146. type: 'radar',
  147. data: [
  148. [900, 900, 900, 900, 900, 900],
  149. ],
  150. symbol: 'none',
  151. lineStyle: {
  152. width: 0
  153. },
  154. itemStyle: {
  155. color: '#2C72C8'
  156. },
  157. areaStyle: {
  158. color: '#2C72C8',
  159. opacity: 0.12
  160. }
  161. },
  162. {
  163. type: 'radar',
  164. data: [
  165. [800, 800, 800, 800, 800, 800]
  166. ],
  167. symbol: 'none',
  168. lineStyle: {
  169. width: 0
  170. },
  171. itemStyle: {
  172. color: '#4175F5'
  173. },
  174. areaStyle: {
  175. color: '#4175F5',
  176. opacity: 0.18
  177. }
  178. },
  179. {
  180. type: 'radar',
  181. data: [
  182. [700, 700, 700, 700, 700, 700]
  183. ],
  184. symbol: 'none',
  185. lineStyle: {
  186. width: 0
  187. },
  188. itemStyle: {
  189. color: '#4175F5'
  190. },
  191. areaStyle: {
  192. color: '#4175F5',
  193. opacity: 0.19
  194. }
  195. },
  196. {
  197. type: 'radar',
  198. data: [
  199. [600, 600, 600, 600, 600, 600],
  200. ],
  201. symbol: 'none',
  202. lineStyle: {
  203. width: 0
  204. },
  205. itemStyle: {
  206. color: '#4175F5'
  207. },
  208. areaStyle: {
  209. color: '#4175F5',
  210. opacity: 0.17
  211. }
  212. },
  213. {
  214. type: 'radar',
  215. data: [
  216. [500, 500, 500, 500, 500, 500],
  217. ],
  218. symbol: 'none',
  219. lineStyle: {
  220. width: 0
  221. },
  222. itemStyle: {
  223. color: '#4175F5'
  224. },
  225. areaStyle: {
  226. color: '#4175F5',
  227. opacity: 0.16
  228. }
  229. },
  230. {
  231. type: 'radar',
  232. data: [
  233. [400, 400, 400, 400, 400, 400],
  234. ],
  235. symbol: 'none',
  236. lineStyle: {
  237. width: 0
  238. },
  239. itemStyle: {
  240. color: '#4175F5'
  241. },
  242. areaStyle: {
  243. color: '#4175F5',
  244. opacity: 0.13
  245. }
  246. },
  247. ]
  248. };
  249. option && myChart.setOption(option);
  250. },
  251. },
  252. }
  253. </script>
  254. <style rel="stylesheet/scss" lang="scss" scoped>
  255. .chart-container {
  256. width: 100%;
  257. height: auto;
  258. position: relative;
  259. padding-bottom: 10px;
  260. display: flex;
  261. }
  262. </style>