VisitAnalysisBar.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. grid: { left: '1%', right: '1%', top: '2 %', bottom: 0, containLabel: true },
  25. xAxis: {
  26. type: 'category',
  27. data: [
  28. '1月',
  29. '2月',
  30. '3月',
  31. '4月',
  32. '5月',
  33. '6月',
  34. '7月',
  35. '8月',
  36. '9月',
  37. '10月',
  38. '11月',
  39. '12月',
  40. ],
  41. },
  42. yAxis: {
  43. type: 'value',
  44. max: 8000,
  45. splitNumber: 4,
  46. },
  47. series: [
  48. {
  49. data: [3000, 2000, 3333, 5000, 3200, 4200, 3200, 2100, 3000, 5100, 6000, 3200, 4800],
  50. type: 'bar',
  51. barMaxWidth: 80,
  52. },
  53. ],
  54. });
  55. });
  56. </script>