From a95e34aad0417ca8aeb0905cc8bb3f210887c999 Mon Sep 17 00:00:00 2001 From: wisonic Date: Tue, 30 Jul 2024 17:48:53 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=9B=BE=E8=A1=A8):=20=E6=9C=80?= =?UTF-8?q?=E5=80=BC=E6=A0=87=E7=AD=BE=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/chart/components/js/extremumUitl.ts | 8 ++++++-- .../src/views/chart/components/js/panel/charts/bar/bar.ts | 3 +++ 2 files changed, 9 insertions(+), 2 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 8fcba910dd..7fd7f5b29a 100644 --- a/core/core-frontend/src/views/chart/components/js/extremumUitl.ts +++ b/core/core-frontend/src/views/chart/components/js/extremumUitl.ts @@ -104,8 +104,10 @@ const noChildrenFieldChart = chart => { export const extremumEvt = (newChart, chart, _options, container) => { chart.container = container - newChart.on('afterrender', ev => { - createExtremumPoint(chart, ev) + newChart.on('beforerender', ev => { + newChart.chart.geometries[0].on('beforerenderlabel', () => { + createExtremumPoint(chart, ev) + }) }) } @@ -158,6 +160,8 @@ export const createExtremumPoint = (chart, ev) => { if (pointObjList && pointObjList.length > 0) { const pointObj = pointObjList[0] const { minItem, maxItem } = findMinMax(pointObjList.reverse()) + minItem._origin.EXTREME = true + maxItem._origin.EXTREME = true let attr let showExtremum = false if (noChildrenFieldChart(chart) || yAxis.length > 1) { diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/bar/bar.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/bar/bar.ts index 2a78ab9aa0..63df539e27 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/bar/bar.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/bar/bar.ts @@ -132,6 +132,9 @@ export class Bar extends G2PlotChartView { fields: [], ...tmpOptions.label, formatter: (data: Datum, _point) => { + if (data.EXTREME) { + return '' + } if (!labelAttr.seriesLabelFormatter?.length) { return data.value }