From 1c3ae8ece98d3e0c5d9913faed281f06ea12a6b2 Mon Sep 17 00:00:00 2001 From: Pete Harverson Date: Thu, 11 Jul 2019 14:36:06 +0100 Subject: [PATCH] [ML] Fixes position of Single Metric zoom when at start of range (#40854) --- .../timeseriesexplorer_controller.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseriesexplorer_controller.js b/x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseriesexplorer_controller.js index 1224edbc441e0..780899be08617 100644 --- a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseriesexplorer_controller.js +++ b/x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseriesexplorer_controller.js @@ -935,14 +935,14 @@ module.controller('MlTimeSeriesExplorerController', function ( $scope.autoZoomDuration = getAutoZoomDuration(); // Check that the zoom times are valid. - // zoomFrom must be at or after dashboard earliest, - // zoomTo must be at or before dashboard latest plus context chart agg interval. + // zoomFrom must be at or after context chart search bounds earliest, + // zoomTo must be at or before context chart search bounds latest. const zoomFrom = moment(zoomState.from, 'YYYY-MM-DDTHH:mm:ss.SSSZ', true); const zoomTo = moment(zoomState.to, 'YYYY-MM-DDTHH:mm:ss.SSSZ', true); - const aggIntervalMs = $scope.contextAggregationInterval.asMilliseconds(); const bounds = timefilter.getActiveBounds(); - const earliest = bounds.min; - const latest = moment(bounds.max).add(aggIntervalMs, 'ms'); + const searchBounds = getBoundsRoundedToInterval(bounds, $scope.contextAggregationInterval, true); + const earliest = searchBounds.min; + const latest = searchBounds.max; if (zoomFrom.isValid() && zoomTo.isValid && zoomTo.isAfter(zoomFrom) &&