diff --git a/src/app/directives/grafanaGraph.js b/src/app/directives/grafanaGraph.js index 8efcee45fd6..8d8e288d3f9 100755 --- a/src/app/directives/grafanaGraph.js +++ b/src/app/directives/grafanaGraph.js @@ -21,20 +21,27 @@ function (angular, $, kbn, moment, _, graphTooltip) { var legendSideLastValue = null; scope.crosshairEmiter = false; - scope.$on('setCrosshair',function(event,pos) { - console.log('setCrosshair'+ pos); - if(dashboard.sharedCrosshair && !scope.crosshairEmiter) { + scope.onAppEvent('setCrosshair', function(event, info) { + // do not need to to this if event is from this panel + if (info.scope === scope) { + return; + } + + if(dashboard.sharedCrosshair) { + console.log("setCrosshair"); var plot = elem.data().plot; - plot.setCrosshair({ x: pos.x, y: pos.y }); + if (plot) { + plot.setCrosshair({ x: info.pos.x, y: info.pos.y }); + } } }); - scope.$on('clearCrosshair',function() { + scope.onAppEvent('clearCrosshair', function() { var plot = elem.data().plot; plot.clearCrosshair(); }); - scope.$on('refresh',function() { + scope.$on('refresh', function() { scope.get_data(); }); diff --git a/src/app/directives/grafanaGraph.tooltip.js b/src/app/directives/grafanaGraph.tooltip.js index 380d948ef5e..0d8fafe498a 100644 --- a/src/app/directives/grafanaGraph.tooltip.js +++ b/src/app/directives/grafanaGraph.tooltip.js @@ -5,17 +5,18 @@ define([ function ($, kbn) { 'use strict'; - function registerTooltipFeatures(elem, dashboard, scope, $rootScope) { + function registerTooltipFeatures(elem, dashboard, scope) { var $tooltip = $('
'); elem.mouseleave(function () { - if(scope.panel.tooltip.shared) { + if (scope.panel.tooltip.shared || dashboard.sharedCrosshair) { var plot = elem.data().plot; - $tooltip.detach(); - $rootScope.$broadcast('clearCrosshair'); - //plot.clearCrosshair(); - plot.unhighlight(); + if (plot) { + $tooltip.detach(); + plot.unhighlight(); + scope.appEvent('clearCrosshair'); + } } }); @@ -33,11 +34,10 @@ function ($, kbn) { var data = plot.getData(); var group, value, timestamp, seriesInfo, format, i, series, hoverIndex, seriesHtml; - scope.crosshairEmiter = true; if(dashboard.sharedCrosshair){ - $rootScope.$broadcast('setCrosshair',pos); + scope.appEvent('setCrosshair', { pos: pos, scope: scope }); } - scope.crosshairEmiter = false; + if (scope.panel.tooltip.shared) { plot.unhighlight(); diff --git a/src/app/panels/graph/styleEditor.html b/src/app/panels/graph/styleEditor.html index 9f4c5c3a1fb..07e72c93f15 100644 --- a/src/app/panels/graph/styleEditor.html +++ b/src/app/panels/graph/styleEditor.html @@ -33,11 +33,7 @@ -
- - -
-
+
@@ -55,7 +51,12 @@
Tooltip
- + + +
+
+ +
diff --git a/src/app/partials/dasheditor.html b/src/app/partials/dasheditor.html index 07e846127fe..9802ab75004 100644 --- a/src/app/partials/dasheditor.html +++ b/src/app/partials/dasheditor.html @@ -29,7 +29,6 @@ -
@@ -75,6 +74,7 @@
+ diff --git a/src/app/services/dashboard/dashboardKeyBindings.js b/src/app/services/dashboard/dashboardKeyBindings.js index b6b4d606c6d..987bb5a71ad 100644 --- a/src/app/services/dashboard/dashboardKeyBindings.js +++ b/src/app/services/dashboard/dashboardKeyBindings.js @@ -29,6 +29,7 @@ function(angular, $) { keyboardManager.bind('ctrl+o', function() { var current = scope.dashboard.sharedCrosshair; scope.dashboard.sharedCrosshair = !current; + scope.dashboard.emit_refresh('refresh'); }, { inputDisabled: true }); keyboardManager.bind('ctrl+h', function() { diff --git a/src/app/services/dashboard/dashboardSrv.js b/src/app/services/dashboard/dashboardSrv.js index d071b286535..40d9b5df55f 100644 --- a/src/app/services/dashboard/dashboardSrv.js +++ b/src/app/services/dashboard/dashboardSrv.js @@ -27,7 +27,7 @@ function (angular, $, kbn, _, moment) { this.timezone = data.timezone || 'browser'; this.editable = data.editable === false ? false : true; this.hideControls = data.hideControls || false; - this.sharedCrosshair = data.sharedCrosshair || true; + this.sharedCrosshair = data.sharedCrosshair || false; this.rows = data.rows || []; this.nav = data.nav || []; this.time = data.time || { from: 'now-6h', to: 'now' };