From 6389356b5b53e858a805a59f4966be07b2d3350a Mon Sep 17 00:00:00 2001 From: Nick Partridge Date: Fri, 25 Oct 2019 08:53:55 -0500 Subject: [PATCH] fix: xDomain to exclude undefined values (#440) --- src/chart_types/xy_chart/utils/series.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/chart_types/xy_chart/utils/series.ts b/src/chart_types/xy_chart/utils/series.ts index 741e29f100..c3566b0160 100644 --- a/src/chart_types/xy_chart/utils/series.ts +++ b/src/chart_types/xy_chart/utils/series.ts @@ -120,18 +120,25 @@ export function splitSeries( const colorValuesKey = getColorValuesAsString(colorValues, specId); colorsValues.set(colorValuesKey, colorValues); const cleanedDatum = cleanDatum(datum, xAccessor, accessor, y0Accessors && y0Accessors[index]); - xValues.add(cleanedDatum.x); - updateSeriesMap(series, [...seriesKey, accessor], cleanedDatum, specId, colorValuesKey); + + if (cleanedDatum.x !== null && cleanedDatum.x !== undefined) { + xValues.add(cleanedDatum.x); + updateSeriesMap(series, [...seriesKey, accessor], cleanedDatum, specId, colorValuesKey); + } }); } else { const colorValues = getColorValues(datum, splitSeriesAccessors); const colorValuesKey = getColorValuesAsString(colorValues, specId); colorsValues.set(colorValuesKey, colorValues); const cleanedDatum = cleanDatum(datum, xAccessor, yAccessors[0], y0Accessors && y0Accessors[0]); - xValues.add(cleanedDatum.x); - updateSeriesMap(series, [...seriesKey], cleanedDatum, specId, colorValuesKey); + + if (cleanedDatum.x !== null && cleanedDatum.x !== undefined) { + xValues.add(cleanedDatum.x); + updateSeriesMap(series, [...seriesKey], cleanedDatum, specId, colorValuesKey); + } } }); + return { rawDataSeries: [...series.values()], colorsValues,