From 71d63406694024ced6b7bcff417d62564d6dac05 Mon Sep 17 00:00:00 2001 From: Timi Date: Thu, 13 Aug 2026 14:26:11 +0800 Subject: [PATCH] fix customer event chart --- .../component/CustomerEventStructureChart.vue | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/pages/customer/component/CustomerEventStructureChart.vue b/src/pages/customer/component/CustomerEventStructureChart.vue index 8acacff..ea893e7 100644 --- a/src/pages/customer/component/CustomerEventStructureChart.vue +++ b/src/pages/customer/component/CustomerEventStructureChart.vue @@ -28,16 +28,25 @@ let statRequestId = 0; const selectedEventIdSet = computed(() => new Set(props.selectedEventIdList)); const visibleEventList = computed(() => eventList.value.filter(item => item.id && selectedEventIdSet.value.has(item.id))); +const shouldRotateAxisLabel = computed(() => visibleEventList.value.length > 4 || visibleEventList.value.some(item => 6 < getEventName(item).length)); const chartOption = computed(() => ({ ...buildCustomerBaseChartOption(props.dateTextList), + legend: { + show: false + }, xAxis: { type: "category", - data: visibleEventList.value.map(item => item.name || "未命名事件"), + data: visibleEventList.value.map(getEventName), axisTick: { show: false }, axisLabel: { - color: "#52607a" + color: "#52607a", + hideOverlap: true, + interval: 0, + overflow: "truncate", + rotate: shouldRotateAxisLabel.value ? 45 : 0, + width: shouldRotateAxisLabel.value ? 72 : 56 } }, series: [ @@ -101,6 +110,10 @@ function getEventColor(event: EventItem): string | undefined { return event.color || undefined; } +function getEventName(event: EventItem): string { + return event.name || "未命名事件"; +} + function groupRecordDailyStatByEventId(list: StoreEventRecordDailyStatView[]): Record { const map: Record = {}; for (const item of list) {