Merge branch 'shared_tooltip' of https://github.com/connection-reset/grafana into connection-reset-shared_tooltip

This commit is contained in:
Torkel Ödegaard
2016-12-06 09:32:22 +01:00
4 changed files with 56 additions and 8 deletions

View File

@@ -34,6 +34,9 @@ module.directive('grafanaGraph', function($rootScope, timeSrv) {
var rootScope = scope.$root;
var panelWidth = 0;
var thresholdManager = new ThresholdManager(ctrl);
var tooltip = new GraphTooltip(elem, dashboard, scope, function() {
return sortedSeries;
});
var plot;
ctrl.events.on('panel-teardown', () => {
@@ -64,6 +67,19 @@ module.directive('grafanaGraph', function($rootScope, timeSrv) {
}
}, scope);
rootScope.onAppEvent('setTooltip', function(event, info) {
// do not need to to this if event is from this panel
// or another panel is in fullscreen mode
if (info.scope === scope || ctrl.otherPanelInFullscreenMode()) {
return;
}
tooltip.setTooltip(info.pos);
}, scope);
rootScope.onAppEvent('clearTooltip', function() {
tooltip.clearTooltip();
}, scope);
// Receive render events
ctrl.events.on('render', function(renderData) {
data = renderData || data;
@@ -565,10 +581,6 @@ module.directive('grafanaGraph', function($rootScope, timeSrv) {
return "%H:%M";
}
var tooltip = new GraphTooltip(elem, dashboard, scope, function() {
return sortedSeries;
});
elem.bind("plotselected", function (event, ranges) {
scope.$apply(function() {
timeSrv.setTime({