Blame view

src/views/dashboard/analysis/components/VisitAnalysisBar.vue 1.28 KB
Vben authored
1
2
3
<template>
  <div ref="chartRef" :style="{ height, width }"></div>
</template>
4
5
<script lang="ts" setup>
  import { onMounted, ref, Ref } from 'vue';
Vben authored
6
  import { useECharts } from '/@/hooks/web/useECharts';
Vben authored
7
8
  import { basicProps } from './props';
9
10
11
12
13
14
15
16
17
18
19
20
21
22
  defineProps({
    ...basicProps,
  });

  const chartRef = ref<HTMLDivElement | null>(null);
  const { setOptions } = useECharts(chartRef as Ref<HTMLDivElement>);
  onMounted(() => {
    setOptions({
      tooltip: {
        trigger: 'axis',
        axisPointer: {
          lineStyle: {
            width: 1,
            color: '#019680',
Vben authored
23
          },
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
        },
      },
      grid: { left: '1%', right: '1%', top: '2  %', bottom: 0, containLabel: true },
      xAxis: {
        type: 'category',
        data: [
          '1月',
          '2月',
          '3月',
          '4月',
          '5月',
          '6月',
          '7月',
          '8月',
          '9月',
          '10月',
          '11月',
          '12月',
        ],
      },
      yAxis: {
        type: 'value',
        max: 8000,
        splitNumber: 4,
      },
      series: [
        {
          data: [3000, 2000, 3333, 5000, 3200, 4200, 3200, 2100, 3000, 5100, 6000, 3200, 4800],
          type: 'bar',
          barMaxWidth: 80,
        },
      ],
    });
Vben authored
57
58
  });
</script>