analytics-trends.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <script lang="ts" setup>
  2. import { onMounted, ref } from 'vue';
  3. import {
  4. EchartsUI,
  5. type EchartsUIType,
  6. useEcharts,
  7. } from '@vben/plugins/echarts';
  8. const chartRef = ref<EchartsUIType>();
  9. const { renderEcharts } = useEcharts(chartRef);
  10. onMounted(() => {
  11. renderEcharts({
  12. grid: {
  13. bottom: 0,
  14. containLabel: true,
  15. left: '1%',
  16. right: '1%',
  17. top: '2 %',
  18. },
  19. series: [
  20. {
  21. areaStyle: {},
  22. data: [
  23. 111, 2000, 6000, 16_000, 33_333, 55_555, 64_000, 33_333, 18_000,
  24. 36_000, 70_000, 42_444, 23_222, 13_000, 8000, 4000, 1200, 333, 222,
  25. 111,
  26. ],
  27. itemStyle: {
  28. color: '#5ab1ef',
  29. },
  30. smooth: true,
  31. type: 'line',
  32. },
  33. {
  34. areaStyle: {},
  35. data: [
  36. 33, 66, 88, 333, 3333, 6200, 20_000, 3000, 1200, 13_000, 22_000,
  37. 11_000, 2221, 1201, 390, 198, 60, 30, 22, 11,
  38. ],
  39. itemStyle: {
  40. color: '#019680',
  41. },
  42. smooth: true,
  43. type: 'line',
  44. },
  45. ],
  46. tooltip: {
  47. axisPointer: {
  48. lineStyle: {
  49. color: '#019680',
  50. width: 1,
  51. },
  52. },
  53. trigger: 'axis',
  54. },
  55. xAxis: {
  56. axisTick: {
  57. show: false,
  58. },
  59. boundaryGap: false,
  60. data: Array.from({ length: 18 }).map((_item, index) => `${index + 6}:00`),
  61. type: 'category',
  62. },
  63. yAxis: [
  64. {
  65. axisTick: {
  66. show: false,
  67. },
  68. max: 80_000,
  69. type: 'value',
  70. },
  71. ],
  72. });
  73. });
  74. </script>
  75. <template>
  76. <EchartsUI ref="chartRef" />
  77. </template>