From d27f73579b72d255bb90959146efc7bb53eee11f Mon Sep 17 00:00:00 2001 From: David Tsay <3614296+davetsay@users.noreply.github.com> Date: Mon, 19 Oct 2020 10:07:51 -0700 Subject: [PATCH] [Plots] Toggle grid lines (#3313) * add toggle button * enable toggle grid lines in plots * fix merge issue * change to new glyphs Co-authored-by: Deep Tailor --- src/plugins/plot/res/templates/mct-plot.html | 14 ++++++---- src/plugins/plot/res/templates/plot.html | 19 ++++++++----- .../plot/res/templates/stacked-plot.html | 27 +++++++++++-------- .../plot/src/plot/MCTPlotController.js | 7 +++++ .../plot/src/telemetry/PlotController.js | 6 +++++ .../src/telemetry/StackedPlotController.js | 5 ++++ 6 files changed, 55 insertions(+), 23 deletions(-) diff --git a/src/plugins/plot/res/templates/mct-plot.html b/src/plugins/plot/res/templates/mct-plot.html index 4810977489..8205de291f 100644 --- a/src/plugins/plot/res/templates/mct-plot.html +++ b/src/plugins/plot/res/templates/mct-plot.html @@ -188,15 +188,19 @@ ng-style="{ right: (100 * (max - tick.value) / interval) + '%', height: '100%' - }"> - + }" + ng-show="plot.gridLines" + > + -
-
+ ng-style="{ bottom: (100 * (tick.value - min) / interval) + '%', width: '100%' }" + ng-show="plot.gridLines" + > +
- + +
diff --git a/src/plugins/plot/res/templates/stacked-plot.html b/src/plugins/plot/res/templates/stacked-plot.html index 73abef3d38..11dc1a55a3 100644 --- a/src/plugins/plot/res/templates/stacked-plot.html +++ b/src/plugins/plot/res/templates/stacked-plot.html @@ -22,23 +22,28 @@
- - - + + + +
option.key === key); }; diff --git a/src/plugins/plot/src/telemetry/PlotController.js b/src/plugins/plot/src/telemetry/PlotController.js index 1853b0d157..2a08730121 100644 --- a/src/plugins/plot/src/telemetry/PlotController.js +++ b/src/plugins/plot/src/telemetry/PlotController.js @@ -60,6 +60,7 @@ define([ this.objectService = objectService; this.exportImageService = exportImageService; this.cursorGuide = false; + this.gridLines = true; $scope.pending = 0; @@ -331,6 +332,11 @@ define([ this.$scope.$broadcast('cursorguide', $event); }; + PlotController.prototype.toggleGridLines = function ($event) { + this.gridLines = !this.gridLines; + this.$scope.$broadcast('toggleGridLines', $event); + }; + return PlotController; }); diff --git a/src/plugins/plot/src/telemetry/StackedPlotController.js b/src/plugins/plot/src/telemetry/StackedPlotController.js index 1259113b4d..c45e2417e4 100644 --- a/src/plugins/plot/src/telemetry/StackedPlotController.js +++ b/src/plugins/plot/src/telemetry/StackedPlotController.js @@ -160,5 +160,10 @@ define([], function () { this.$scope.$broadcast('cursorguide', $event); }; + StackedPlotController.prototype.toggleGridLines = function ($event) { + this.gridLines = !this.gridLines; + this.$scope.$broadcast('toggleGridLines', $event); + }; + return StackedPlotController; });