analytics-visits.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <script lang="ts" setup>
  2. import { onMounted, ref } from 'vue';
  3. import { EchartsUI, type EchartsUIType, useEcharts } from '@vben/chart-ui';
  4. const chartRef = ref<EchartsUIType>();
  5. const { renderEcharts } = useEcharts(chartRef);
  6. onMounted(() => {
  7. renderEcharts({
  8. grid: {
  9. bottom: 0,
  10. containLabel: true,
  11. left: '1%',
  12. right: '1%',
  13. top: '2 %',
  14. },
  15. series: [
  16. {
  17. barMaxWidth: 80,
  18. // color: '#4f69fd',
  19. data: [
  20. 3000, 2000, 3333, 5000, 3200, 4200, 3200, 2100, 3000, 5100, 6000,
  21. 3200, 4800,
  22. ],
  23. type: 'bar',
  24. },
  25. ],
  26. tooltip: {
  27. axisPointer: {
  28. lineStyle: {
  29. // color: '#4f69fd',
  30. width: 1,
  31. },
  32. },
  33. trigger: 'axis',
  34. },
  35. xAxis: {
  36. data: Array.from({ length: 12 }).map((_item, index) => `${index + 1}月`),
  37. type: 'category',
  38. },
  39. yAxis: {
  40. max: 8000,
  41. splitNumber: 4,
  42. type: 'value',
  43. },
  44. });
  45. });
  46. </script>
  47. <template>
  48. <EchartsUI ref="chartRef" />
  49. </template>