Skip to content

Commit 909b672

Browse files
joao-m-santosjoao
authored and
joao
committed
🐛 Fix unhandled line-group null value cases
1 parent 7b10524 commit 909b672

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

packages/lib/src/components/groups/lume-line-group/lume-line-group.vue

+4-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,10 @@ function getPointPosition(pointIndex: number, datasetIndex: number) {
192192
x: isBandScale(xScale.value)
193193
? props.xScale(domain.value[pointIndex]) + xAxisOffset.value
194194
: props.xScale(pointIndex),
195-
y: yScale.value(value),
195+
y:
196+
value === null
197+
? yScale.value(yScale.value.domain()[1] as number)
198+
: yScale.value(value),
196199
};
197200
}
198201

packages/lib/src/composables/line-null-values.ts

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ export function useLineNullValues(data: Ref<InternalData>) {
5151
const step = diff / (length + 1);
5252
const sum = step * (index + 1);
5353

54+
if (start == null && end == null) return null;
55+
5456
if (start > end) return start - sum;
5557
else return start + sum;
5658
}

packages/lib/src/composables/line-values.ts

+3
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,8 @@ export function getLinePathDefinition(
5151
)
5252
.y((d) => yScale(d));
5353

54+
// Do not calculate path definition if all values are null
55+
if (values.every((v) => v == null)) return null;
56+
5457
return lineFn(values);
5558
}

0 commit comments

Comments
 (0)