distribution.vue 4.9 KB

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