From 188e98a78bd899b09b2d4464f2d30b04cae1c05a Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Thu, 11 Dec 2014 19:33:09 -0800 Subject: [PATCH] [Plot] Update stacked plots immediately When changes to pan-zoom bounds are made in one subplot, this will effect the pan-zoom bounds of other subplots. Ensure this occurs immediately. WTD-625. --- platform/features/plot/res/templates/plot.html | 2 +- platform/features/plot/src/PlotController.js | 12 ++++++++++++ .../plot/src/elements/PlotPanZoomStackGroup.js | 4 +--- platform/features/plot/src/modes/PlotStackMode.js | 10 ++++------ 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/platform/features/plot/res/templates/plot.html b/platform/features/plot/res/templates/plot.html index 4f94fde285..7d348826d3 100644 --- a/platform/features/plot/res/templates/plot.html +++ b/platform/features/plot/res/templates/plot.html @@ -63,7 +63,7 @@ + ng-mouseup="subplot.endMarquee($event); plot.update()"> diff --git a/platform/features/plot/src/PlotController.js b/platform/features/plot/src/PlotController.js index 841dc95726..53793f7530 100644 --- a/platform/features/plot/src/PlotController.js +++ b/platform/features/plot/src/PlotController.js @@ -90,6 +90,10 @@ define( modeOptions.getModeHandler().plotTelemetry(prepared); } + function updateSubplot(subplot) { + subplot.update(); + } + function setupModes(telemetryObjects) { modeOptions = new PlotModeOptions(telemetryObjects || []); } @@ -159,6 +163,14 @@ define( */ getSubPlots: function () { return modeOptions.getModeHandler().getSubPlots(); + }, + /** + * Explicitly update all plots. + */ + update: function () { + modeOptions.getModeHandler() + .getSubPlots() + .forEach(updateSubplot); } }; diff --git a/platform/features/plot/src/elements/PlotPanZoomStackGroup.js b/platform/features/plot/src/elements/PlotPanZoomStackGroup.js index 1f37b8ef63..b10ec2723a 100644 --- a/platform/features/plot/src/elements/PlotPanZoomStackGroup.js +++ b/platform/features/plot/src/elements/PlotPanZoomStackGroup.js @@ -63,15 +63,13 @@ define( return { popPanZoom: popPanZoom, clearPanZoom: clearPanZoom, + setBasePanZoom: setBasePanZoom, getDepth: function () { return stacks.length > 0 ? stacks[0].getDepth() : 0; }, getPanZoomStack: function (index) { return decoratedStacks[index]; - }, - getPanZoomStacks: function () { - return decoratedStacks; } }; diff --git a/platform/features/plot/src/modes/PlotStackMode.js b/platform/features/plot/src/modes/PlotStackMode.js index 78abc16d50..77ebb94c41 100644 --- a/platform/features/plot/src/modes/PlotStackMode.js +++ b/platform/features/plot/src/modes/PlotStackMode.js @@ -37,12 +37,10 @@ define( function plotTelemetry(prepared) { // Fit to the boundaries of the data, but don't // override any user-initiated pan-zoom changes. - panZoomStackGroup.getPanZoomStacks().forEach(function (stack) { - stack.setBasePanZoom( - prepared.getOrigin(), - prepared.getDimensions() - ); - }); + panZoomStackGroup.setBasePanZoom( + prepared.getOrigin(), + prepared.getDimensions() + ); subplots.forEach(function (subplot, index) { plotTelemetryTo(subplot, prepared, index);