Rap 原分销系统代码Web
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

f8d453599b1558085b1d547a008b300c5a0b8982.svn-base 2.9KB

před 5 měsíci
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <div :class="className" :style="{height:height,width:width}" />
  3. </template>
  4. <script>
  5. import echarts from 'echarts'
  6. require('echarts/theme/macarons') // echarts theme
  7. import { debounce } from '@/utils'
  8. const animationDuration = 3000
  9. export default {
  10. props: {
  11. className: {
  12. type: String,
  13. default: 'chart'
  14. },
  15. width: {
  16. type: String,
  17. default: '100%'
  18. },
  19. height: {
  20. type: String,
  21. default: '300px'
  22. }
  23. },
  24. data() {
  25. return {
  26. chart: null
  27. }
  28. },
  29. mounted() {
  30. this.initChart()
  31. this.__resizeHandler = debounce(() => {
  32. if (this.chart) {
  33. this.chart.resize()
  34. }
  35. }, 100)
  36. window.addEventListener('resize', this.__resizeHandler)
  37. },
  38. beforeDestroy() {
  39. if (!this.chart) {
  40. return
  41. }
  42. window.removeEventListener('resize', this.__resizeHandler)
  43. this.chart.dispose()
  44. this.chart = null
  45. },
  46. methods: {
  47. initChart() {
  48. this.chart = echarts.init(this.$el, 'macarons')
  49. this.chart.setOption({
  50. tooltip: {
  51. trigger: 'axis',
  52. axisPointer: { // 坐标轴指示器,坐标轴触发有效
  53. type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  54. }
  55. },
  56. radar: {
  57. radius: '66%',
  58. center: ['50%', '42%'],
  59. splitNumber: 8,
  60. splitArea: {
  61. areaStyle: {
  62. color: 'rgba(127,95,132,.3)',
  63. opacity: 1,
  64. shadowBlur: 45,
  65. shadowColor: 'rgba(0,0,0,.5)',
  66. shadowOffsetX: 0,
  67. shadowOffsetY: 15
  68. }
  69. },
  70. indicator: [
  71. { name: 'Sales', max: 10000 },
  72. { name: 'Administration', max: 20000 },
  73. { name: 'Information Techology', max: 20000 },
  74. { name: 'Customer Support', max: 20000 },
  75. { name: 'Development', max: 20000 },
  76. { name: 'Marketing', max: 20000 }
  77. ]
  78. },
  79. legend: {
  80. left: 'center',
  81. bottom: '10',
  82. data: ['Allocated Budget', 'Expected Spending', 'Actual Spending']
  83. },
  84. series: [{
  85. type: 'radar',
  86. symbolSize: 0,
  87. areaStyle: {
  88. normal: {
  89. shadowBlur: 13,
  90. shadowColor: 'rgba(0,0,0,.2)',
  91. shadowOffsetX: 0,
  92. shadowOffsetY: 10,
  93. opacity: 1
  94. }
  95. },
  96. data: [
  97. {
  98. value: [5000, 7000, 12000, 11000, 15000, 14000],
  99. name: 'Allocated Budget'
  100. },
  101. {
  102. value: [4000, 9000, 15000, 15000, 13000, 11000],
  103. name: 'Expected Spending'
  104. },
  105. {
  106. value: [5500, 11000, 12000, 15000, 12000, 12000],
  107. name: 'Actual Spending'
  108. }
  109. ],
  110. animationDuration: animationDuration
  111. }]
  112. })
  113. }
  114. }
  115. }
  116. </script>