distribution.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <!--
  2. 描述: 客户分布
  3. 作者: Jack Chen
  4. 日期: 2020-05-09
  5. -->
  6. <template>
  7. <div class="distribution-container">
  8. <div class="chart" id="chart_right2"></div>
  9. </div>
  10. </template>
  11. <script>
  12. export default {
  13. name: "distribution",
  14. data() {
  15. return {
  16. }
  17. },
  18. mounted() {
  19. this.getEchartRight2();
  20. },
  21. methods: {
  22. getEchartRight2() {
  23. let myChart = echarts.init(document.getElementById('chart_right2'));
  24. let option = {
  25. color: ['#EAEA26', '#906BF9', '#FE5656', '#01E17E', '#3DD1F9', '#FFAD05', '#4465fc'],
  26. tooltip: {
  27. trigger: 'item',
  28. formatter: '{b} : {c} ({d}%)'
  29. },
  30. polar: {},
  31. angleAxis: {
  32. interval: 1,
  33. type: 'category',
  34. data: [],
  35. z: 10,
  36. axisLine: {
  37. show: false,
  38. lineStyle: {
  39. color: '#0B4A6B',
  40. width: 5,
  41. type: 'solid'
  42. },
  43. },
  44. axisLabel: {
  45. interval: 0,
  46. show: true,
  47. color: '#0B4A6B',
  48. margin: 8,
  49. fontSize: 16
  50. },
  51. },
  52. radiusAxis: {
  53. min: 40,
  54. max: 120,
  55. interval: 20,
  56. axisLine: {
  57. show: false,
  58. lineStyle: {
  59. color: '#0B3E5E',
  60. width: 1,
  61. type: 'solid'
  62. },
  63. },
  64. axisLabel: {
  65. formatter: '{value} %',
  66. show: false,
  67. padding: [0, 0, 20, 0],
  68. color: '#0B3E5E',
  69. fontSize: 16
  70. },
  71. splitLine: {
  72. lineStyle: {
  73. color: '#0B3E5E',
  74. width: 2,
  75. type: "solid"
  76. }
  77. }
  78. },
  79. calculable: true,
  80. series: [{
  81. type: 'pie',
  82. radius: ['6%', '10%'],
  83. hoverAnimation: false,
  84. labelLine: {
  85. normal: {
  86. show: false,
  87. length: 30,
  88. length2: 50
  89. },
  90. emphasis: {
  91. show: false
  92. }
  93. },
  94. tooltip: {
  95. show: false
  96. },
  97. data: [{
  98. name: '',
  99. value: 0,
  100. itemStyle: {
  101. normal: {
  102. color: '#0B4A6B'
  103. }
  104. }
  105. }]
  106. }, {
  107. type: 'pie',
  108. radius: ['90%', '95%'],
  109. hoverAnimation: false,
  110. labelLine: {
  111. normal: {
  112. show: false,
  113. length: 30,
  114. length2: 50
  115. },
  116. emphasis: {
  117. show: false
  118. }
  119. },
  120. tooltip: {
  121. show: false
  122. },
  123. data: [{
  124. name: '',
  125. value: 0,
  126. itemStyle: {
  127. normal: {
  128. color: '#0B4A6B'
  129. }
  130. }
  131. }]
  132. },{
  133. stack: 'a',
  134. type: 'pie',
  135. radius: ['20%', '80%'],
  136. roseType: 'area',
  137. zlevel: 10,
  138. label: {
  139. normal: {
  140. show: true,
  141. formatter: '{b}',
  142. textStyle: {
  143. fontSize: 12,
  144. },
  145. position: 'outside'
  146. },
  147. emphasis: {
  148. show: false
  149. }
  150. },
  151. labelLine: {
  152. normal: {
  153. show: true,
  154. length: 15,
  155. length2: 50,
  156. lineStyle: {
  157. type: 'dotted'
  158. }
  159. },
  160. emphasis: {
  161. show: true
  162. }
  163. },
  164. data: [{
  165. value: 35,
  166. name: '湖南'
  167. },{
  168. value: 28,
  169. name: '河北'
  170. },{
  171. value: 23,
  172. name: '广东'
  173. },{
  174. value: 18,
  175. name: '四川'
  176. },{
  177. value: 13,
  178. name: '浙江'
  179. },{
  180. value: 8,
  181. name: '江苏'
  182. },{
  183. value: 5,
  184. name: '湖北'
  185. }]
  186. }]
  187. }
  188. myChart.setOption(option, true);
  189. window.addEventListener('resize', () => {
  190. myChart.resize();
  191. });
  192. },
  193. },
  194. beforeDestroy() {
  195. }
  196. };
  197. </script>
  198. <style lang="scss" scoped>
  199. .distribution-container {
  200. .chart {
  201. height: 3rem;
  202. }
  203. }
  204. </style>