From 9b39250dca90949da4f14c6b9768202b92fdc263 Mon Sep 17 00:00:00 2001 From: jianneng-fit2cloud Date: Tue, 31 Dec 2024 18:00:31 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=9F=B1=E6=9D=A1=E5=9B=BE=E6=9D=A1=E4=BB=B6=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=EF=BC=8C=E4=B8=A4=E4=B8=AA=E7=9B=B8=E5=90=8C=E7=9A=84=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=EF=BC=8C=E5=B9=B6=E4=B8=8D=E6=98=AF=E6=9C=80=E5=90=8E?= =?UTF-8?q?=E7=9A=84=E5=AD=97=E6=AE=B5=E9=85=8D=E7=BD=AE=E7=94=9F=E6=95=88?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/chart/components/js/panel/common/common_antv.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/core-frontend/src/views/chart/components/js/panel/common/common_antv.ts b/core/core-frontend/src/views/chart/components/js/panel/common/common_antv.ts index dcb1191b76..589a12559e 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/common/common_antv.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/common/common_antv.ts @@ -1646,11 +1646,15 @@ export const addConditionsStyleColorToData = (chart: Chart, options) => { */ const getColorByConditions = (quotaList: [], values: number | number[], chart) => { const { threshold } = parseJson(chart.senior) - const conditions = threshold.lineThreshold ?? [] const { basicStyle } = parseJson(chart.customAttr) const currentValue = Array.isArray(values) ? values[1] - values[0] : values if (!currentValue) return undefined - for (const condition of conditions) { + // 同样的指标只取最后一个 + const conditionMap = new Map() + for (const condition of threshold.lineThreshold ?? []) { + conditionMap.set(condition.fieldId, condition) + } + for (const condition of conditionMap.values()) { if (chart.type === 'progress-bar' && chart.yAxisExt?.[0]?.id !== quotaList[0]) continue if (!quotaList.includes(condition.fieldId) && chart.type !== 'waterfall') continue for (const tc of condition.conditions) {