From cedba98bea5ffcfdc6d2b1adf7aa1303f5fe27ac Mon Sep 17 00:00:00 2001 From: wisonic-s Date: Wed, 31 Jan 2024 15:29:58 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=A7=86=E5=9B=BE-=E6=9F=B1=E7=8A=B6?= =?UTF-8?q?=E5=9B=BE):=20=E4=BF=AE=E5=A4=8D=E5=9F=BA=E7=A1=80=E6=9F=B1?= =?UTF-8?q?=E7=8A=B6=E5=9B=BE=E4=BF=AE=E6=94=B9=E6=8C=87=E6=A0=87=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E5=90=8E=E8=87=AA=E5=AE=9A=E4=B9=89=E9=85=8D=E8=89=B2?= =?UTF-8?q?=E8=A2=AB=E9=87=8D=E7=BD=AE=20#7665?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/frontend/src/views/chart/chart/util.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/core/frontend/src/views/chart/chart/util.js b/core/frontend/src/views/chart/chart/util.js index bae35d77ae..8fb892c680 100644 --- a/core/frontend/src/views/chart/chart/util.js +++ b/core/frontend/src/views/chart/chart/util.js @@ -3513,9 +3513,16 @@ export function customColor(custom, res, colors) { let flag = false for (let j = 0; j < custom.length; j++) { const c = custom[j] - if (r.name === c.name) { + if (c.id && c.id === r.id) { flag = true result.push(c) + break + } + if (r.name === c.name) { + flag = true + c.id = r.id + result.push(c) + break } } if (!flag) { @@ -3636,6 +3643,7 @@ export function getColors(chart, colors, reset) { const s = series[i] seriesColors.push({ name: s.name, + id: s.id, color: colors[i % colors.length], isCustom: false }) @@ -3662,16 +3670,6 @@ export function getColors(chart, colors, reset) { } else { if (chart.data) { const data = chart.data.data - // data 的维度值,需要根据自定义顺序排序 - // let customSortData - // if (Object.prototype.toString.call(chart.customSort) === '[object Array]') { - // customSortData = JSON.parse(JSON.stringify(chart.customSort)) - // } else { - // customSortData = JSON.parse(chart.customSort) - // } - // if (customSortData && customSortData.length > 0) { - // data = customSort(customSortData, data) - // } for (let i = 0; i < data.length; i++) { const s = data[i] seriesColors.push({