line3.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <script setup lang="ts">
  2. import * as echarts from 'echarts'
  3. const chartRef = ref()
  4. onMounted(() => {
  5. echarts.init(chartRef.value).setOption({
  6. color: ['#80FFA5','#37A2FF', '#00DDFF', '#FF0087', '#FFBF00'],
  7. tooltip: {
  8. trigger: 'axis',
  9. axisPointer: {
  10. type: 'cross',
  11. label: {
  12. backgroundColor: '#6a7985'
  13. }
  14. }
  15. },
  16. grid: {
  17. left: '3%',
  18. right: '4%',
  19. bottom: '3%',
  20. containLabel: true
  21. },
  22. xAxis: [
  23. {
  24. type: 'category',
  25. boundaryGap: false,
  26. data: ['2021年9月', '2021年10月', '2021年11月', '2021年12月','2022年1月', '2022年2月', '2022年3月', '2022年4月','2022年5月', '2022年6月', '2022年7月', '2022年8月']
  27. }
  28. ],
  29. yAxis: [
  30. {
  31. type: 'value',
  32. splitLine: {
  33. show: false
  34. },
  35. }
  36. ],
  37. series: [
  38. {
  39. name: '应用度(%)',
  40. type: 'line',
  41. stack: 'Total',
  42. smooth: true,
  43. lineStyle: {
  44. width: 0
  45. },
  46. showSymbol: false,
  47. areaStyle: {
  48. opacity: 0.8,
  49. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  50. {
  51. offset: 0,
  52. color: 'rgb(9,180,177,1)'
  53. },
  54. {
  55. offset: 1,
  56. color: 'rgba(9,180,177,0.1)'
  57. }
  58. ])
  59. },
  60. emphasis: {
  61. focus: 'series'
  62. },
  63. data: [1.3, 3.02, 3, 2,5, 1.6, 2.7, 3,7, 3, 5, 3]
  64. },
  65. ]
  66. })
  67. })
  68. </script>
  69. <template>
  70. <div ref="chartRef" class="w-full h-full " />
  71. </template>