From d5eff14c3575a19b3a90bb36339a50e2dee05172 Mon Sep 17 00:00:00 2001 From: jianneng-fit2cloud Date: Fri, 29 Nov 2024 17:33:41 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=8A=98=E7=BA=BF=E5=9B=BE=E6=9C=80=E5=80=BC=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E8=A2=AB=E9=81=AE=E6=8C=A1=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=E8=B6=85=E8=BF=87=E6=98=BE=E7=A4=BA=E8=8C=83=E5=9B=B4=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E6=9C=80=E5=80=BC=E6=A0=87=E7=AD=BE=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=9C=A8=E6=95=B0=E6=8D=AE=E7=82=B9=E4=B8=8B=E6=96=B9=20#13354?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/chart/components/js/extremumUitl.ts | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/core/core-frontend/src/views/chart/components/js/extremumUitl.ts b/core/core-frontend/src/views/chart/components/js/extremumUitl.ts index 732a7e9e87..dfc029bf92 100644 --- a/core/core-frontend/src/views/chart/components/js/extremumUitl.ts +++ b/core/core-frontend/src/views/chart/components/js/extremumUitl.ts @@ -85,8 +85,7 @@ function createExtremumDiv(id, value, formatterCfg, chart) { const span = document.createElement('span') span.setAttribute( 'style', - `display: block; - width: 0px; + `width: 0px; height: 0px; border: 4px solid transparent; border-top-color: red; @@ -319,10 +318,9 @@ export const createExtremumPoint = (chart, ev) => { ) if (pointElement && point._origin.EXTREME) { pointElement.style.position = 'absolute' - pointElement.style.top = - (point.y[1] ? point.y[1] : point.y) - - (fontSize + (pointSize ? pointSize : 0) + 12) + - 'px' + const top = + (point.y[1] ? point.y[1] : point.y) - (fontSize + (pointSize ? pointSize : 0) + 12) + pointElement.style.top = top + 'px' pointElement.style.left = point.x + 'px' pointElement.style.zIndex = '10' pointElement.style.fontSize = fontSize + 'px' @@ -334,6 +332,18 @@ export const createExtremumPoint = (chart, ev) => { pointElement.children[0]['style'].borderTopColor = 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')' pointElement.style.display = 'table' + // 显示箭头 + const childNode = pointElement.childNodes[1] + // 最值在数据点下方显示 + const translateYValue = Math.ceil(point.y + Math.abs(Math.floor(top)) + 6) + // 最值dom高度超过50%时,最值dom向下 + if (top < 0 && (Math.abs(top) / point.y) * 100 >= 50) { + pointElement.style.transform = `translateX(-50%) translateY(${translateYValue}px)` + childNode.style.marginTop = '-12px' + childNode.style.transform = 'rotate(180deg)' + } else { + childNode.style.display = 'block' + } } }) } else {