echart-order.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <view> <qiun-data-charts type="pie" :opts="opts" :chartData="chartData" :errorShow="false" /> </view>
  3. </template>
  4. <script>
  5. import { mapState, mapMutations } from 'vuex'
  6. export default {
  7. data() {
  8. return {
  9. chartData: {},
  10. opts: {
  11. timing: 'easeOut',
  12. duration: 1000,
  13. rotate: false,
  14. rotateLock: false,
  15. color: [
  16. '#1890FF',
  17. '#91CB74',
  18. '#FAC858',
  19. '#EE6666',
  20. '#73C0DE',
  21. '#3CA272',
  22. '#FC8452',
  23. '#9A60B4',
  24. '#ea7ccc'
  25. ],
  26. padding: [5, 5, 5, 5],
  27. fontSize: 13,
  28. fontColor: '#666666',
  29. dataLabel: true,
  30. dataPointShape: true,
  31. dataPointShapeType: 'solid',
  32. touchMoveLimit: 60,
  33. enableScroll: false,
  34. enableMarkLine: false,
  35. legend: {
  36. show: false,
  37. position: 'bottom',
  38. lineHeight: 25,
  39. float: 'bottom',
  40. padding: 5,
  41. margin: 5,
  42. backgroundColor: 'rgba(0,0,0,0)',
  43. borderColor: 'rgba(0,0,0,0)',
  44. borderWidth: 0,
  45. fontSize: 13,
  46. fontColor: '#666666',
  47. hiddenColor: '#CECECE',
  48. itemGap: 10
  49. },
  50. title: {
  51. name: '订单总量',
  52. fontSize: 15,
  53. color: '#666666',
  54. offsetX: 0,
  55. offsetY: 0
  56. },
  57. subtitle: {
  58. name: '70%',
  59. fontSize: 25,
  60. color: '#7cb5ec',
  61. offsetX: 0,
  62. offsetY: 0
  63. },
  64. extra: {
  65. ring: {
  66. ringWidth: 30,
  67. activeOpacity: 0.5,
  68. activeRadius: 10,
  69. offsetAngle: 0,
  70. labelWidth: 15,
  71. border: true,
  72. borderWidth: 3,
  73. borderColor: '#FFFFFF',
  74. centerColor: '#FFFFFF',
  75. customRadius: 0,
  76. linearType: 'none'
  77. },
  78. tooltip: {
  79. showBox: true,
  80. showArrow: true,
  81. showCategory: false,
  82. borderWidth: 0,
  83. borderRadius: 0,
  84. borderColor: '#000000',
  85. borderOpacity: 0.7,
  86. bgColor: '#000000',
  87. bgOpacity: 0.7,
  88. gridType: 'solid',
  89. dashLength: 4,
  90. gridColor: '#CCCCCC',
  91. boxPadding: 3,
  92. fontSize: 13,
  93. lineHeight: 20,
  94. fontColor: '#FFFFFF',
  95. legendShow: true,
  96. legendShape: 'auto',
  97. splitLine: true,
  98. horizentalLine: false,
  99. xAxisLabel: false,
  100. yAxisLabel: false,
  101. labelBgColor: '#FFFFFF',
  102. labelBgOpacity: 0.7,
  103. labelFontColor: '#666666'
  104. }
  105. }
  106. }
  107. }
  108. },
  109. created() {
  110. console.log('111111111')
  111. this.getServerData()
  112. },
  113. filters: {},
  114. computed: {},
  115. methods: {
  116. getServerData() {
  117. //模拟从服务器获取数据时的延时
  118. setTimeout(() => {
  119. //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
  120. let res = {
  121. series: [
  122. {
  123. data: [
  124. { name: '普通订单【62.5%】', value: 50 },
  125. { name: '二手订单【0%】', value: 5 },
  126. { name: '返佣订单【0%】', value: 5 },
  127. { name: '部分退款订单【0%】', value: 2 },
  128. { name: '全部退款订单【0%】', value: 4 },
  129. { name: '已关闭订单【37.5%】', value: 6 }
  130. ]
  131. }
  132. ]
  133. }
  134. this.chartData = JSON.parse(JSON.stringify(res))
  135. }, 500)
  136. }
  137. },
  138. onShow() {}
  139. }
  140. </script>
  141. <style lang="scss">
  142. .charts-box {
  143. width: 100%;
  144. height: 600rpx;
  145. box-sizing: border-box;
  146. padding: 20rpx;
  147. }
  148. </style>