From 2d4185adc6a94bd943d00d3ec61112c72cc0055b Mon Sep 17 00:00:00 2001 From: Melissa Date: Mon, 29 Apr 2024 16:38:23 -0600 Subject: [PATCH 1/2] ensure chart focus zoom is set correctly --- .../timeseriesexplorer/timeseriesexplorer.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer.js b/x-pack/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer.js index 8569b318c3b1b..ed32ba1fbd6f4 100644 --- a/x-pack/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer.js +++ b/x-pack/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer.js @@ -463,9 +463,9 @@ export class TimeSeriesExplorer extends React.Component { if ( // If the user's focus range is not defined (i.e. no 'zoom' parameter restored from the appState URL), // then calculate the default focus range to use - zoom === undefined && - (focusRange === undefined || - this.previousSelectedForecastId !== this.props.selectedForecastId) + zoom === undefined || + focusRange === undefined || + this.previousSelectedForecastId !== this.props.selectedForecastId ) { focusRange = this.mlTimeSeriesExplorer.calculateDefaultFocusRange( autoZoomDuration, @@ -476,10 +476,12 @@ export class TimeSeriesExplorer extends React.Component { this.previousSelectedForecastId = this.props.selectedForecastId; } - this.contextChartSelected({ - from: focusRange[0], - to: focusRange[1], - }); + if (focusRange !== undefined) { + this.contextChartSelected({ + from: focusRange[0], + to: focusRange[1], + }); + } } this.setState(stateUpdate); From d614c66d3bcac75ff9db89131ee71842ee43e475 Mon Sep 17 00:00:00 2001 From: Melissa Date: Wed, 1 May 2024 10:12:01 -0600 Subject: [PATCH 2/2] remove unnecessary previous forecast id check --- .../application/timeseriesexplorer/timeseriesexplorer.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/x-pack/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer.js b/x-pack/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer.js index ed32ba1fbd6f4..e3f5bd0a3792c 100644 --- a/x-pack/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer.js +++ b/x-pack/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer.js @@ -464,8 +464,7 @@ export class TimeSeriesExplorer extends React.Component { // If the user's focus range is not defined (i.e. no 'zoom' parameter restored from the appState URL), // then calculate the default focus range to use zoom === undefined || - focusRange === undefined || - this.previousSelectedForecastId !== this.props.selectedForecastId + focusRange === undefined ) { focusRange = this.mlTimeSeriesExplorer.calculateDefaultFocusRange( autoZoomDuration,