diff --git a/src/app/directives/grafanaGraph.js b/src/app/directives/grafanaGraph.js
index 42ef1b91cb5..8efcee45fd6 100755
--- a/src/app/directives/grafanaGraph.js
+++ b/src/app/directives/grafanaGraph.js
@@ -19,6 +19,20 @@ function (angular, $, kbn, moment, _, graphTooltip) {
var dashboard = scope.dashboard;
var data, annotations;
var legendSideLastValue = null;
+ scope.crosshairEmiter = false;
+
+ scope.$on('setCrosshair',function(event,pos) {
+ console.log('setCrosshair'+ pos);
+ if(dashboard.sharedCrosshair && !scope.crosshairEmiter) {
+ var plot = elem.data().plot;
+ plot.setCrosshair({ x: pos.x, y: pos.y });
+ }
+ });
+
+ scope.$on('clearCrosshair',function() {
+ var plot = elem.data().plot;
+ plot.clearCrosshair();
+ });
scope.$on('refresh',function() {
scope.get_data();
@@ -147,7 +161,7 @@ function (angular, $, kbn, moment, _, graphTooltip) {
color: '#666'
},
crosshair: {
- mode: panel.tooltip.shared ? "x" : null
+ mode: panel.tooltip.shared || dashboard.sharedCrosshair ? "x" : null
}
};
@@ -394,7 +408,7 @@ function (angular, $, kbn, moment, _, graphTooltip) {
elem.html('
');
}
- graphTooltip.register(elem, dashboard, scope);
+ graphTooltip.register(elem, dashboard, scope, $rootScope);
elem.bind("plotselected", function (event, ranges) {
scope.$apply(function() {
diff --git a/src/app/directives/grafanaGraph.tooltip.js b/src/app/directives/grafanaGraph.tooltip.js
index 513d7126985..380d948ef5e 100644
--- a/src/app/directives/grafanaGraph.tooltip.js
+++ b/src/app/directives/grafanaGraph.tooltip.js
@@ -5,7 +5,7 @@ define([
function ($, kbn) {
'use strict';
- function registerTooltipFeatures(elem, dashboard, scope) {
+ function registerTooltipFeatures(elem, dashboard, scope, $rootScope) {
var $tooltip = $('
');
@@ -13,7 +13,8 @@ function ($, kbn) {
if(scope.panel.tooltip.shared) {
var plot = elem.data().plot;
$tooltip.detach();
- plot.clearCrosshair();
+ $rootScope.$broadcast('clearCrosshair');
+ //plot.clearCrosshair();
plot.unhighlight();
}
});
@@ -32,6 +33,11 @@ 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.crosshairEmiter = false;
if (scope.panel.tooltip.shared) {
plot.unhighlight();
@@ -60,11 +66,15 @@ function ($, kbn) {
seriesInfo = series.info;
format = scope.panel.y_formats[seriesInfo.yaxis - 1];
- if (scope.panel.stack && scope.panel.tooltip.value_type === 'individual') {
- value = series.data[hoverIndex][1];
+ if (scope.panel.stack) {
+ if (scope.panel.stack && scope.panel.tooltip.value_type === 'individual') {
+ value = series.data[hoverIndex][1];
+ } else {
+ last_value += series.data[hoverIndex][1];
+ value = last_value;
+ }
} else {
- last_value += series.data[hoverIndex][1];
- value = last_value;
+ value = series.data[hoverIndex][1];
}
value = kbn.valueFormats[format](value, series.yaxis.tickDecimals);
diff --git a/src/app/partials/dasheditor.html b/src/app/partials/dasheditor.html
index ae8608b97d1..07e846127fe 100644
--- a/src/app/partials/dasheditor.html
+++ b/src/app/partials/dasheditor.html
@@ -29,6 +29,7 @@
+
diff --git a/src/app/services/dashboard/dashboardKeyBindings.js b/src/app/services/dashboard/dashboardKeyBindings.js
index 11d5e2d4787..b6b4d606c6d 100644
--- a/src/app/services/dashboard/dashboardKeyBindings.js
+++ b/src/app/services/dashboard/dashboardKeyBindings.js
@@ -18,6 +18,7 @@ function(angular, $) {
keyboardManager.unbind('ctrl+s');
keyboardManager.unbind('ctrl+r');
keyboardManager.unbind('ctrl+z');
+ keyboardManager.unbind('ctrl+o');
keyboardManager.unbind('esc');
});
@@ -25,6 +26,11 @@ function(angular, $) {
scope.appEvent('show-dash-editor', { src: 'app/partials/search.html' });
}, { inputDisabled: true });
+ keyboardManager.bind('ctrl+o', function() {
+ var current = scope.dashboard.sharedCrosshair;
+ scope.dashboard.sharedCrosshair = !current;
+ }, { inputDisabled: true });
+
keyboardManager.bind('ctrl+h', function() {
var current = scope.dashboard.hideControls;
scope.dashboard.hideControls = !current;
diff --git a/src/app/services/dashboard/dashboardSrv.js b/src/app/services/dashboard/dashboardSrv.js
index 17313a207d5..d071b286535 100644
--- a/src/app/services/dashboard/dashboardSrv.js
+++ b/src/app/services/dashboard/dashboardSrv.js
@@ -27,6 +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.rows = data.rows || [];
this.nav = data.nav || [];
this.time = data.time || { from: 'now-6h', to: 'now' };