From 600ff1a3ee4ca11bf05ca149035ad424fb08b508 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Sep 2015 15:07:46 -0700 Subject: [PATCH] [Plot] Requery on event Requery on a query change event from a time conductor, WTD-1515 --- platform/features/plot/src/PlotController.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/platform/features/plot/src/PlotController.js b/platform/features/plot/src/PlotController.js index c8a76e09ec..a5772b8411 100644 --- a/platform/features/plot/src/PlotController.js +++ b/platform/features/plot/src/PlotController.js @@ -65,6 +65,7 @@ define( subPlotFactory = new SubPlotFactory(telemetryFormatter), cachedObjects = [], updater, + lastBounds, handle; // Populate the scope with axis information (specifically, options @@ -139,13 +140,14 @@ define( } // Change the displayable bounds - function setBasePanZoom(event, bounds) { + function setBasePanZoom(unused, bounds) { var start = bounds.start, end = bounds.end; if (updater) { updater.setDomainBounds(start, end); self.update(); } + lastBounds = bounds; } // Create a new subscription; telemetrySubscriber gets @@ -175,6 +177,18 @@ define( } } + // Initiate a new query for data because query bounds changed + function requery() { + if (handle) { + recreateUpdater(); + requestTelemetry(); + // Keep any externally-provided bounds + if (lastBounds) { + setBasePanZoom({}, lastBounds); + } + } + } + this.modeOptions = new PlotModeOptions([], subPlotFactory); this.updateValues = updateValues; @@ -190,6 +204,9 @@ define( // Respond to external bounds changes $scope.$on("telemetry:display:bounds", setBasePanZoom); + // Respond to external query range changes + $scope.$on("telemetry:query:bounds", throttle(requery, 250)); + // Unsubscribe when the plot is destroyed $scope.$on("$destroy", releaseSubscription);