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 }