From d6ac450dfc4005bc9391b48566c8197585a4db19 Mon Sep 17 00:00:00 2001 From: Mohamed Marrouchi Date: Thu, 25 Apr 2024 19:55:28 +0100 Subject: [PATCH] fix: discontinued data for line charts --- packages/ez-core/src/utils/scale.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/ez-core/src/utils/scale.ts b/packages/ez-core/src/utils/scale.ts index a2362fe..547a78b 100644 --- a/packages/ez-core/src/utils/scale.ts +++ b/packages/ez-core/src/utils/scale.ts @@ -26,7 +26,7 @@ export const scaleDatumValue = ( ) => { if (domainKey in datum) { const value = datum[domainKey] as T; - const scaleValue = AnyScale.scale(value as NumberLike) || 0; + const scaleValue = AnyScale.scale(value as NumberLike); return scaleValue; } throw new Error('Domain key does not exist in the supplied data'); @@ -143,9 +143,11 @@ export const scalePointData = ( xScale: AnyScale, yScale: AnyScale ): PointDatum[] => { - return data.map(datum => { - return scalePointDatum(datum, xDomainKey, yDomainKey, xScale, yScale); - }); + return data + .map(datum => { + return scalePointDatum(datum, xDomainKey, yDomainKey, xScale, yScale); + }) + .filter(d => typeof d.x !== undefined && typeof d.y !== 'undefined'); }; export const scaleBubbleData = (