mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
This commit is contained in:
parent
60215bdb91
commit
462dbd1fcf
1 changed files with 10 additions and 10 deletions
|
@ -794,20 +794,20 @@ module.controller('MlTimeSeriesExplorerController', function (
|
||||||
// Calculate the 'auto' zoom duration which shows data at bucket span granularity.
|
// Calculate the 'auto' zoom duration which shows data at bucket span granularity.
|
||||||
$scope.autoZoomDuration = getAutoZoomDuration();
|
$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.
|
||||||
const zoomFrom = moment(zoomState.from, 'YYYY-MM-DDTHH:mm:ss.SSSZ', true);
|
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 zoomTo = moment(zoomState.to, 'YYYY-MM-DDTHH:mm:ss.SSSZ', true);
|
||||||
|
const aggIntervalMs = $scope.contextAggregationInterval.asMilliseconds();
|
||||||
// Get the time span of data in the context chart.
|
const bounds = timefilter.getActiveBounds();
|
||||||
// Valid zoomTo is the time of the last bucket plus the aggregation interval.
|
const earliest = bounds.min;
|
||||||
const combinedData = $scope.contextForecastData === undefined ?
|
const latest = moment(bounds.max).add(aggIntervalMs, 'ms');
|
||||||
$scope.contextChartData : $scope.contextChartData.concat($scope.contextForecastData);
|
|
||||||
const earliestDataDate = _.first(combinedData).date;
|
|
||||||
const latestDataDate = new Date(_.last(combinedData).date.valueOf() +
|
|
||||||
$scope.contextAggregationInterval.asMilliseconds());
|
|
||||||
|
|
||||||
if (zoomFrom.isValid() && zoomTo.isValid &&
|
if (zoomFrom.isValid() && zoomTo.isValid &&
|
||||||
zoomFrom.isBetween(earliestDataDate, latestDataDate, null, '[]') &&
|
zoomTo.isAfter(zoomFrom) &&
|
||||||
zoomTo.isBetween(earliestDataDate, latestDataDate, null, '[]')) {
|
zoomFrom.isBetween(earliest, latest, null, '[]') &&
|
||||||
|
zoomTo.isBetween(earliest, latest, null, '[]')) {
|
||||||
return [zoomFrom.toDate(), zoomTo.toDate()];
|
return [zoomFrom.toDate(), zoomTo.toDate()];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue