Skip to content

Commit

Permalink
fix: xDomain to exclude undefined values (opensearch-project#440)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickofthyme authored Oct 25, 2019
1 parent 512fdc0 commit 54a6bf1
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions packages/osd-charts/src/chart_types/xy_chart/utils/series.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 54a6bf1

Please sign in to comment.