From 7b84bce5770a0738a7d18ddf7b2f424f2c1a9fe7 Mon Sep 17 00:00:00 2001 From: Dmitrii Arnautov Date: Wed, 16 Oct 2019 16:32:08 +0200 Subject: [PATCH] [ML] fallback to the lower of the model plot results for y axis --- .../components/timeseries_chart/timeseries_chart.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js b/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js index e078a04213462..81852f025fb1f 100644 --- a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js +++ b/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js @@ -587,7 +587,15 @@ const TimeseriesChartIntl = injectI18n(class TimeseriesChart extends React.Compo // If an anomaly coincides with a gap in the data, use the anomaly actual value. metricValue = Array.isArray(d.actual) ? d.actual[0] : d.actual; } - return d.lower !== undefined ? Math.min(metricValue, d.lower) : metricValue; + if (d.lower !== undefined) { + if (metricValue !== null && metricValue !== undefined) { + return Math.min(metricValue, d.lower); + } else { + // Set according to the minimum of the lower of the model plot results. + return d.lower; + } + } + return metricValue; }); yMax = d3.max(combinedData, (d) => { let metricValue = d.value;