From 2abc8abc6bca6fb53fe9c2fe365d9de6366379b0 Mon Sep 17 00:00:00 2001 From: wisonic Date: Wed, 21 Jan 2026 19:27:14 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20fix(=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8):=20=E4=BF=AE=E5=A4=8D=E5=A0=86=E5=8F=A0=E6=9F=B1?= =?UTF-8?q?=E6=9D=A1=E5=9B=BE=E8=87=AA=E5=AE=9A=E4=B9=89=E5=9B=BE=E4=BE=8B?= =?UTF-8?q?=E9=A1=BA=E5=BA=8F=E5=92=8C=E8=87=AA=E5=AE=9A=E4=B9=89=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E6=95=88=E6=9E=9C=E5=86=B2=E7=AA=81=20#17649?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/chart/components/js/util.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/core/core-frontend/src/views/chart/components/js/util.ts b/core/core-frontend/src/views/chart/components/js/util.ts index 9865e95aba..df3c4b67d4 100644 --- a/core/core-frontend/src/views/chart/components/js/util.ts +++ b/core/core-frontend/src/views/chart/components/js/util.ts @@ -976,10 +976,21 @@ export function setUpStackSeriesColor( return } seriesSet.add(d.category) + }) + const cats = [...seriesSet] + const stackAxis = extStack[0] + if (stackAxis.sort === 'custom_sort' && stackAxis.customSort?.length) { + cats.sort((a, b) => { + const aIndex = stackAxis.customSort.indexOf(a) + const bIndex = stackAxis.customSort.indexOf(b) + return aIndex - bIndex + }) + } + cats.forEach((c, i) => { result.push({ - id: d.category, - name: d.category, - color: colors[(seriesSet.size - 1) % colors.length] + id: c, + name: c, + color: colors[i % colors.length] }) }) } else {