From 604dcbc6b245a42260350da25a8b1694e8f505ef Mon Sep 17 00:00:00 2001 From: benrubson Date: Sun, 16 Oct 2016 00:30:50 +0200 Subject: [PATCH] Missing values, corect tooltip --- public/app/plugins/panel/graph/graph_tooltip.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/public/app/plugins/panel/graph/graph_tooltip.js b/public/app/plugins/panel/graph/graph_tooltip.js index b901c2c8ed6..6477a4a46a9 100644 --- a/public/app/plugins/panel/graph/graph_tooltip.js +++ b/public/app/plugins/panel/graph/graph_tooltip.js @@ -17,7 +17,7 @@ function ($, _) { var initial = last*ps; var len = series.datapoints.points.length; for (var j = initial; j < len; j += ps) { - if ((series.datapoints.points[initial] != null && series.datapoints.points[j] == null) || series.datapoints.points[j] > posX) { + if ((series.datapoints.points[initial] != null && series.datapoints.points[j] == null && ! series.lines.steps) || series.datapoints.points[j] > posX) { return Math.max(j - ps, 0)/ps; } } @@ -61,7 +61,7 @@ function ($, _) { } hoverIndex = this.findHoverIndexFromData(pos.x, series); - hoverDistance = Math.abs(pos.x - series.data[hoverIndex][0]); + hoverDistance = pos.x - series.data[hoverIndex][0]; pointTime = series.data[hoverIndex][0]; if (series.stack) { @@ -102,9 +102,6 @@ function ($, _) { }); } - // Find point which closer to pointer - results.time = _.min(results, 'distance').time; - return results; }; @@ -174,7 +171,7 @@ function ($, _) { continue; } - if (! distance || hoverInfo.distance < distance) { + if (! distance || (hoverInfo.distance >=0 && (hoverInfo.distance < distance || distance < 0)) || (hoverInfo.distance < 0 && hoverInfo.distance > distance)) { distance = hoverInfo.distance; time = hoverInfo.time; }