mirror of
https://github.com/grafana/grafana.git
synced 2024-11-30 20:54:22 -06:00
Merge branch 'issue-3063' of https://github.com/alexanderzobnin/grafana into alexanderzobnin-issue-3063
This commit is contained in:
commit
34804bda6d
@ -1,7 +1,8 @@
|
||||
define([
|
||||
'jquery',
|
||||
'lodash'
|
||||
],
|
||||
function ($) {
|
||||
function ($, _) {
|
||||
'use strict';
|
||||
|
||||
function GraphTooltip(elem, dashboard, scope, getSeriesFn) {
|
||||
@ -40,8 +41,9 @@ function ($) {
|
||||
};
|
||||
|
||||
this.getMultiSeriesPlotHoverInfo = function(seriesList, pos) {
|
||||
var value, i, series, hoverIndex;
|
||||
var value, i, series, hoverIndex, hoverDistance;
|
||||
var results = [];
|
||||
var seriesTimes = new Array(seriesList.length);
|
||||
|
||||
//now we know the current X (j) position for X and Y values
|
||||
var last_value = 0; //needed for stacked values
|
||||
@ -60,7 +62,13 @@ function ($) {
|
||||
}
|
||||
|
||||
hoverIndex = this.findHoverIndexFromData(pos.x, series);
|
||||
results.time = series.data[hoverIndex][0];
|
||||
|
||||
// Store distance for each highlighted point
|
||||
hoverDistance = Math.abs(pos.x - series.data[hoverIndex][0]);
|
||||
seriesTimes[i] = {
|
||||
time: series.data[hoverIndex][0],
|
||||
distance: hoverDistance
|
||||
};
|
||||
|
||||
if (series.stack) {
|
||||
if (panel.tooltip.value_type === 'individual') {
|
||||
@ -87,6 +95,9 @@ function ($) {
|
||||
}
|
||||
}
|
||||
|
||||
// Find point which closer to pointer
|
||||
results.time = _.min(seriesTimes, 'distance').time;
|
||||
|
||||
return results;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user