From 8c197bee048d90b995cc1261e56f216ed3fedb4c Mon Sep 17 00:00:00 2001 From: lai <371757574@qq.com> Date: Wed, 20 Nov 2024 16:31:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/perfManage/goldTarget/index.vue | 26 ++--------------------- 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/src/views/perfManage/goldTarget/index.vue b/src/views/perfManage/goldTarget/index.vue index 3d6eee32..d2a87a82 100644 --- a/src/views/perfManage/goldTarget/index.vue +++ b/src/views/perfManage/goldTarget/index.vue @@ -415,29 +415,8 @@ function fnRanderChart() { //定义图表的配置对象,tooltip的出发方式为axis tooltip: { trigger: 'axis', - position: function ( - point: number[], - size: { viewSize: number[]; contentSize: number[] } - ) { - const [x, y] = point; - const [viewWidth] = size.viewSize; - const [tooltipWidth, tooltipHeight] = size.contentSize; - - // 距离右侧的距离 - const rightSpace = viewWidth - x; - - // 计算垂直方向的居中位置 - // 将 tooltip 的中心点对齐到鼠标位置 - const verticalOffset = -tooltipHeight / 2; - - // 如果右侧空间不足以显示tooltip(假设需要20px的安全距离) - if (rightSpace < tooltipWidth + 20) { - // 向左显示,垂直居中 - return [x - tooltipWidth - 10, y + verticalOffset]; - } - - // 默认向右显示,垂直居中 - return [x + 10, y + verticalOffset]; + position: function (pt: any) { + return [pt[0], '10%']; }, }, xAxis: { @@ -547,7 +526,6 @@ function fnRanderChartData() { if (queryParams.sortOrder === 'desc') { orgData = orgData.toReversed(); } - for (const item of orgData) { chartDataXAxisData.push(parseDateToStr(+item['timeGroup'])); const keys = Object.keys(item);