analytics-visits.vue 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. barMaxWidth: 80,
  22. // color: '#4f69fd',
  23. data: [
  24. 3000, 2000, 3333, 5000, 3200, 4200, 3200, 2100, 3000, 5100, 6000,
  25. 3200, 4800,
  26. ],
  27. type: 'bar',
  28. },
  29. ],
  30. tooltip: {
  31. axisPointer: {
  32. lineStyle: {
  33. // color: '#4f69fd',
  34. width: 1,
  35. },
  36. },
  37. trigger: 'axis',
  38. },
  39. xAxis: {
  40. data: Array.from({ length: 12 }).map((_item, index) => `${index + 1}月`),
  41. type: 'category',
  42. },
  43. yAxis: {
  44. max: 8000,
  45. splitNumber: 4,
  46. type: 'value',
  47. },
  48. });
  49. });
  50. </script>
  51. <template>
  52. <EchartsUI ref="chartRef" />
  53. </template>