From 0f11bea2516d80c840ab33d320b6d980afb68c81 Mon Sep 17 00:00:00 2001 From: wisonic-s Date: Tue, 2 Jan 2024 15:58:23 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=A7=86=E5=9B=BE):=20=E9=83=A8=E5=88=86?= =?UTF-8?q?=E8=A7=86=E5=9B=BE=E5=88=87=E6=8D=A2=E5=9B=BE=E5=BA=93=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/frontend/src/views/chart/chart/util.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/frontend/src/views/chart/chart/util.js b/core/frontend/src/views/chart/chart/util.js index 178a10625c..ceede3c23f 100644 --- a/core/frontend/src/views/chart/chart/util.js +++ b/core/frontend/src/views/chart/chart/util.js @@ -3533,9 +3533,11 @@ export function getColors(chart, colors, reset) { if (chart.data) { const data = chart.data.data const stackData = [] - for (let i = 0; i < data.length; i++) { - const s = data[i] - stackData.push(s.category) + if (data?.length) { + for (let i = 0; i < data.length; i++) { + const s = data[i] + stackData.push(s.category) + } } const sArr = stackData.filter(function(item, index, stackData) { return stackData.indexOf(item, 0) === index