From 0b7753ea2a6a9e72e38538521a5146536bda95ae Mon Sep 17 00:00:00 2001 From: ulleo Date: Wed, 26 Jun 2024 10:02:50 +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=E7=BA=BF=E7=BB=84=E5=90=88=E5=9B=BE=E7=A9=BA=E5=80=BC?= =?UTF-8?q?=E5=A4=84=E7=90=86=E4=B8=8D=E7=94=9F=E6=95=88=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/chart/components/js/util.ts | 33 ++++++++++++++++--- 1 file changed, 29 insertions(+), 4 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 6100f516e1..5570f53866 100644 --- a/core/core-frontend/src/views/chart/components/js/util.ts +++ b/core/core-frontend/src/views/chart/components/js/util.ts @@ -238,12 +238,19 @@ export const quotaViews = ['label', 'richTextView', 'indicator', 'gauge', 'liqui export function handleEmptyDataStrategy(chart: Chart, options: O): O { const { data } = options as unknown as Options + const isChartMix = chart.type.includes('chart-mix') if (!data?.length) { return options } const strategy = parseJson(chart.senior).functionCfg.emptyDataStrategy if (strategy === 'ignoreData') { - handleIgnoreData(data) + if (isChartMix) { + for (let i = 0; i < data.length; i++) { + handleIgnoreData(data[i] as Record[]) + } + } else { + handleIgnoreData(data) + } return options } const { yAxis, xAxisExt, extStack } = chart @@ -252,7 +259,13 @@ export function handleEmptyDataStrategy(chart: Chart, opt case 'breakLine': { if (multiDimension) { // 多维度保持空 - handleBreakLineMultiDimension(data) + if (isChartMix) { + for (let i = 0; i < data.length; i++) { + handleBreakLineMultiDimension(data[i] as Record[]) + } + } else { + handleBreakLineMultiDimension(data) + } } return { ...options, @@ -262,10 +275,22 @@ export function handleEmptyDataStrategy(chart: Chart, opt case 'setZero': { if (multiDimension) { // 多维度置0 - handleSetZeroMultiDimension(data) + if (isChartMix) { + for (let i = 0; i < data.length; i++) { + handleSetZeroMultiDimension(data[i] as Record[]) + } + } else { + handleSetZeroMultiDimension(data) + } } else { // 单维度置0 - handleSetZeroSingleDimension(data) + if (isChartMix) { + for (let i = 0; i < data.length; i++) { + handleSetZeroSingleDimension(data[i] as Record[]) + } + } else { + handleSetZeroSingleDimension(data) + } } break }