fix customer event chart

This commit is contained in:
Timi
2026-08-13 14:26:11 +08:00
parent 0066a537a1
commit 71d6340669
@@ -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<EChartsOption>(() => ({
...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<string, StoreEventRecordDailyStatView[]> {
const map: Record<string, StoreEventRecordDailyStatView[]> = {};
for (const item of list) {