lime-echart.nvue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <view style="width: 100%; height: 408px;">
  3. <l-echart ref="chartRef" @finished="init"></l-echart>
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. data() {
  9. return {
  10. showTip: false,
  11. option: {
  12. tooltip: {
  13. trigger: 'axis',
  14. // shadowBlur: 0,
  15. textStyle: {
  16. textShadowBlur: 0
  17. },
  18. renderMode: 'richText',
  19. },
  20. legend: {
  21. data: ['邮件营销', '联盟广告', '视频广告', '直接访问', '搜索引擎']
  22. },
  23. grid: {
  24. left: '3%',
  25. right: '4%',
  26. bottom: '3%',
  27. containLabel: true
  28. },
  29. xAxis: {
  30. type: 'category',
  31. boundaryGap: false,
  32. data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
  33. },
  34. yAxis: {
  35. type: 'value'
  36. },
  37. series: [
  38. {
  39. name: '邮件营销',
  40. type: 'line',
  41. stack: '总量',
  42. data: [120, 132, 101, 134, 90, 230, 210]
  43. },
  44. {
  45. name: '联盟广告',
  46. type: 'line',
  47. stack: '总量',
  48. data: [220, 182, 191, 234, 290, 330, 310]
  49. },
  50. {
  51. name: '视频广告',
  52. type: 'line',
  53. stack: '总量',
  54. data: [150, 232, 201, 154, 190, 330, 410]
  55. },
  56. {
  57. name: '直接访问',
  58. type: 'line',
  59. stack: '总量',
  60. data: [320, 332, 301, 334, 390, 330, 320]
  61. },
  62. {
  63. name: '搜索引擎',
  64. type: 'line',
  65. stack: '总量',
  66. data: [820, 932, 901, 934, 1290, 1330, 1320]
  67. }
  68. ]
  69. }
  70. }
  71. },
  72. mounted() {
  73. console.log('lime echarts nvue')
  74. },
  75. methods: {
  76. init() {
  77. const chartRef = this.$refs['chartRef']
  78. chartRef.init(chart => {
  79. chart.setOption(this.option);
  80. setTimeout(()=>{
  81. const option = {
  82. tooltip: {
  83. trigger: 'axis',
  84. // shadowBlur: 0,
  85. textStyle: {
  86. textShadowBlur: 0
  87. },
  88. renderMode: 'richText',
  89. },
  90. legend: {
  91. data: ['邮件营销', '联盟广告', '视频广告', '直接访问', '搜索引擎']
  92. },
  93. grid: {
  94. left: '3%',
  95. right: '4%',
  96. bottom: '3%',
  97. containLabel: true
  98. },
  99. xAxis: {
  100. type: 'category',
  101. boundaryGap: false,
  102. data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
  103. },
  104. yAxis: {
  105. type: 'value'
  106. },
  107. series: [
  108. {
  109. name: '邮件营销',
  110. type: 'line',
  111. stack: '总量',
  112. data: [120, 132, 101, 134, 90, 230, 210]
  113. },
  114. {
  115. name: '联盟广告',
  116. type: 'line',
  117. stack: '总量',
  118. data: [220, 182, 191, 234, 290, 330, 310]
  119. },
  120. {
  121. name: '视频广告',
  122. type: 'line',
  123. stack: '总量',
  124. data: [150, 232, 201, 154, 190, 330, 410]
  125. },
  126. {
  127. name: '直接访问',
  128. type: 'line',
  129. stack: '总量',
  130. data: [320, 332, 301, 334, 390, 330, 320]
  131. },
  132. {
  133. name: '搜索引擎',
  134. type: 'line',
  135. stack: '总量',
  136. data: [820, 932, 901, 934, 1290, 1330, 1320]
  137. }
  138. ]
  139. }
  140. chart.setOption(option);
  141. },1000)
  142. })
  143. },
  144. save() {
  145. // this.$refs.chart.canvasToTempFilePath({
  146. // success(res) {
  147. // console.log('res::::', res)
  148. // }
  149. // })
  150. }
  151. }
  152. }
  153. </script>
  154. <style>
  155. </style>