VisitAnalysis.vue 2.4 KB

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