From f54547776d0943d4a2fd356bee1e86c2405e8dd0 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Mon, 20 Nov 2017 12:06:34 +0300 Subject: [PATCH] graph: disable zoom in non-timeseries modes (#9914) --- public/app/plugins/panel/graph/graph.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/public/app/plugins/panel/graph/graph.ts b/public/app/plugins/panel/graph/graph.ts index 82bad53164c..f8567d02fad 100755 --- a/public/app/plugins/panel/graph/graph.ts +++ b/public/app/plugins/panel/graph/graph.ts @@ -688,7 +688,14 @@ function graphDirective($rootScope, timeSrv, popoverSrv, contextSrv) { } elem.bind("plotselected", function (event, ranges) { + if (panel.xaxis.mode !== 'time') { + // Skip if panel in histogram or series mode + plot.clearSelection(); + return; + } + if ((ranges.ctrlKey || ranges.metaKey) && contextSrv.isEditor) { + // Add annotation setTimeout(() => { eventManager.updateTime(ranges.xaxis); }, 100); @@ -703,6 +710,11 @@ function graphDirective($rootScope, timeSrv, popoverSrv, contextSrv) { }); elem.bind("plotclick", function (event, pos, item) { + if (panel.xaxis.mode !== 'time') { + // Skip if panel in histogram or series mode + return; + } + if ((pos.ctrlKey || pos.metaKey) && contextSrv.isEditor) { // Skip if range selected (added in "plotselected" event handler) let isRangeSelection = pos.x !== pos.x1;