analytics-visits.vue 1.1 KB

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