VisitAnalysis.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <div ref="chartRef" :style="{ height, width }"></div>
  3. </template>
  4. <script lang="ts">
  5. import { basicProps } from './props';
  6. </script>
  7. <script lang="ts" setup>
  8. import { onMounted, ref, Ref } from 'vue';
  9. import { useECharts } from '/@/hooks/web/useECharts';
  10. defineProps({
  11. ...basicProps,
  12. });
  13. const chartRef = ref<HTMLDivElement | null>(null);
  14. const { setOptions } = useECharts(chartRef as Ref<HTMLDivElement>);
  15. onMounted(() => {
  16. setOptions({
  17. tooltip: {
  18. trigger: 'axis',
  19. axisPointer: {
  20. lineStyle: {
  21. width: 1,
  22. color: '#019680',
  23. },
  24. },
  25. },
  26. xAxis: {
  27. type: 'category',
  28. boundaryGap: false,
  29. data: [...new Array(18)].map((_item, index) => `${index + 6}:00`),
  30. splitLine: {
  31. show: true,
  32. lineStyle: {
  33. width: 1,
  34. type: 'solid',
  35. color: 'rgba(226,226,226,0.5)',
  36. },
  37. },
  38. axisTick: {
  39. show: false,
  40. },
  41. },
  42. yAxis: [
  43. {
  44. type: 'value',
  45. max: 80000,
  46. splitNumber: 4,
  47. axisTick: {
  48. show: false,
  49. },
  50. splitArea: {
  51. show: true,
  52. areaStyle: {
  53. color: ['rgba(255,255,255,0.2)', 'rgba(226,226,226,0.2)'],
  54. },
  55. },
  56. },
  57. ],
  58. grid: { left: '1%', right: '1%', top: '2 %', bottom: 0, containLabel: true },
  59. series: [
  60. {
  61. smooth: true,
  62. data: [
  63. 111, 222, 4000, 18000, 33333, 55555, 66666, 33333, 14000, 36000, 66666, 44444, 22222,
  64. 11111, 4000, 2000, 500, 333, 222, 111,
  65. ],
  66. type: 'line',
  67. areaStyle: {},
  68. itemStyle: {
  69. color: '#5ab1ef',
  70. },
  71. },
  72. {
  73. smooth: true,
  74. data: [
  75. 33, 66, 88, 333, 3333, 5000, 18000, 3000, 1200, 13000, 22000, 11000, 2221, 1201, 390,
  76. 198, 60, 30, 22, 11,
  77. ],
  78. type: 'line',
  79. areaStyle: {},
  80. itemStyle: {
  81. color: '#019680',
  82. },
  83. },
  84. ],
  85. });
  86. });
  87. </script>