From 24795ff3c487e99a2eaf236b95e2310d82776457 Mon Sep 17 00:00:00 2001 From: wisonic Date: Wed, 31 Jul 2024 15:16:11 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E7=9B=B8=E5=90=8C?= =?UTF-8?q?=E7=9A=84=E6=9C=80=E5=80=BC=E5=8F=AA=E9=9A=90=E8=97=8F=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/chart/components/js/extremumUitl.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 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 7fd7f5b29a..51c0706957 100644 --- a/core/core-frontend/src/views/chart/components/js/extremumUitl.ts +++ b/core/core-frontend/src/views/chart/components/js/extremumUitl.ts @@ -105,6 +105,13 @@ const noChildrenFieldChart = chart => { export const extremumEvt = (newChart, chart, _options, container) => { chart.container = container newChart.on('beforerender', ev => { + ev.view.on('beforepaint', () => { + newChart.chart.geometries[0]?.beforeMappingData.forEach(i => { + const { minItem, maxItem } = findMinMax(i) + minItem._origin.EXTREME = true + maxItem._origin.EXTREME = true + }) + }) newChart.chart.geometries[0].on('beforerenderlabel', () => { createExtremumPoint(chart, ev) }) @@ -120,6 +127,8 @@ const findMinMax = (data): { minItem; maxItem } => { if (maxItem === undefined || currentItem._origin.value > maxItem._origin.value) { maxItem = currentItem } + delete minItem?._origin.EXTREME + delete maxItem?._origin.EXTREME return { minItem, maxItem } }, { minItem: undefined, maxItem: undefined } @@ -159,9 +168,7 @@ export const createExtremumPoint = (chart, ev) => { geometriesDataArray?.forEach(pointObjList => { if (pointObjList && pointObjList.length > 0) { const pointObj = pointObjList[0] - const { minItem, maxItem } = findMinMax(pointObjList.reverse()) - minItem._origin.EXTREME = true - maxItem._origin.EXTREME = true + const [minItem, maxItem] = pointObjList.filter(i => i._origin.EXTREME) let attr let showExtremum = false if (noChildrenFieldChart(chart) || yAxis.length > 1) { @@ -195,7 +202,7 @@ export const createExtremumPoint = (chart, ev) => { const pointElement = document.getElementById( 'point_' + point._origin.category + '-' + point._origin.value ) - if (pointElement) { + if (pointElement && point._origin.EXTREME) { pointElement.style.position = 'absolute' pointElement.style.position = 'absolute' pointElement.style.top =