Skip to content

Commit

Permalink
Fix stacked areas overflow on null values when connectNulls is true
Browse files Browse the repository at this point in the history
  • Loading branch information
alxnddr committed Feb 15, 2024
1 parent 031a908 commit 536da2c
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/chart/line/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,27 @@ export function getStackedOnPoint(
data: SeriesData,
idx: number
) {
let value = NaN;
let stackedOverValue = NaN;
let stackResultValue = NaN;
if (dataCoordInfo.stacked) {
value = data.get(data.getCalculationInfo('stackedOverDimension'), idx) as number;
stackedOverValue = data.get(
data.getCalculationInfo('stackedOverDimension'),
idx
) as number;
stackResultValue = data.get(
data.getCalculationInfo('stackResultDimension'),
idx
) as number;
}
if (isNaN(value)) {
value = dataCoordInfo.valueStart;

if (isNaN(stackedOverValue) && !isNaN(stackResultValue)) {
stackedOverValue = dataCoordInfo.valueStart;
}

const baseDataOffset = dataCoordInfo.baseDataOffset;
const stackedData = [];
stackedData[baseDataOffset] = data.get(dataCoordInfo.baseDim, idx);
stackedData[1 - baseDataOffset] = value;
stackedData[1 - baseDataOffset] = stackedOverValue;

return coordSys.dataToPoint(stackedData);
}

0 comments on commit 536da2c

Please sign in to comment.