From 60e9685b7e8a4ef424bac4d56788587c58786161 Mon Sep 17 00:00:00 2001 From: stt Date: Mon, 17 Nov 2025 10:36:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=96=E5=80=BC=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/dailyTrendChart.vue | 40 ++++++++++++++----- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/src/components/cockpit/exceedanceLevel/components/dailyTrendChart.vue b/src/components/cockpit/exceedanceLevel/components/dailyTrendChart.vue index cdd8fb4..6985ad4 100644 --- a/src/components/cockpit/exceedanceLevel/components/dailyTrendChart.vue +++ b/src/components/cockpit/exceedanceLevel/components/dailyTrendChart.vue @@ -44,18 +44,36 @@ const init = () => { itemStyle: { opacity: 0 }, //去圆点 right: 70 }, - xAxis: { - type: 'time', - axisLabel: { - formatter: { - day: '{MM}-{dd}', - month: '{MM}', - year: '{yyyy}' - } - } - }, + tooltip: { + trigger: 'axis', + formatter: (params: any) => { + if (!params || params.length === 0) return '' - yAxis: [{}, {}], + // 使用第一个项目的轴标签作为时间标题 + let tooltipText = params[0].axisValueLabel + '
' + + // 遍历所有项目并累加到tooltipText中 + params.forEach((item: any) => { + // 将数值格式化为保留两位小数 + const formattedValue = Math.round(item.value[1] * 100) / 100 + tooltipText += `${item.marker} ${item.seriesName}: ${formattedValue}
` + }) + + return tooltipText + } + }, + xAxis: { + type: 'time', + axisLabel: { + formatter: { + day: '{MM}-{dd}', + month: '{MM}', + year: '{yyyy}' + } + } + }, + + yAxis: [{}, {}], grid: { left: '1%', right: '45px',