Skip to content

Commit

Permalink
[ML] filter out undefined values
Browse files Browse the repository at this point in the history
  • Loading branch information
darnautov committed Jun 3, 2021
1 parent 645e34f commit feb2b45
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ export const HeatmapComponent: FC<HeatmapRenderProps> = ({
const tableId = Object.keys(data.tables)[0];
const table = data.tables[tableId];

let chartData = table.rows;

const xAxisColumnIndex = table.columns.findIndex((v) => v.id === args.xAccessor);
const yAxisColumnIndex = table.columns.findIndex((v) => v.id === args.yAccessor);

Expand All @@ -64,6 +62,8 @@ export const HeatmapComponent: FC<HeatmapRenderProps> = ({
return null;
}

let chartData = table.rows.filter((v) => typeof v[args.valueAccessor!] === 'number');

if (!yAxisColumn) {
// required for tooltip
chartData = chartData.map((row) => {
Expand All @@ -77,6 +77,8 @@ export const HeatmapComponent: FC<HeatmapRenderProps> = ({
const xAxisMeta = xAxisColumn.meta;
const isTimeBasedSwimLane = xAxisMeta.type === 'date';

// Fallback to the ordinal scale type when a single row of data is provided.
// Related issue https://github.com/elastic/elastic-charts/issues/1184
const xScaleType =
isTimeBasedSwimLane && chartData.length > 1 ? ScaleType.Time : ScaleType.Ordinal;

Expand Down

0 comments on commit feb2b45

Please sign in to comment.