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 = $('