From e4ed74c3298bb9dff07e5f8a1ed5411652f8f948 Mon Sep 17 00:00:00 2001 From: Aleksandr Lesnenko Date: Thu, 8 Feb 2024 16:27:04 -0300 Subject: [PATCH] Fix stacked areas overflow on null values when connectNulls is true --- src/chart/line/helper.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/chart/line/helper.ts b/src/chart/line/helper.ts index 13a1c2c01a7..f2b4f641053 100644 --- a/src/chart/line/helper.ts +++ b/src/chart/line/helper.ts @@ -24,6 +24,7 @@ import type Cartesian2D from '../../coord/cartesian/Cartesian2D'; import SeriesData from '../../data/SeriesData'; import Axis from '../../coord/Axis'; import type { LineSeriesOption } from './LineSeries'; +import { SeriesModel } from '../../echarts'; interface CoordInfo { dataDimsForPoint: string[] @@ -121,7 +122,12 @@ export function getStackedOnPoint( if (dataCoordInfo.stacked) { value = data.get(data.getCalculationInfo('stackedOverDimension'), idx) as number; } - if (isNaN(value)) { + + const seriesModel = data.hostModel as SeriesModel; + const seriesValue = seriesModel.getRawValue(idx) as number; + + // If there's a series value but no stacked value, start the area from the coordinate system start value + if (isNaN(value) && !isNaN(seriesValue)) { value = dataCoordInfo.valueStart; }