Skip to content

Commit e71114f

Browse files
author
benrubson
committed
Come back to grafana#6287 for graph_tooltip.js
as it is an only one loop solution
1 parent 9797845 commit e71114f

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

public/app/plugins/panel/graph/graph_tooltip.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@ function ($) {
2121
var initial = last*ps;
2222
var len = series.datapoints.points.length;
2323
for (var j = initial; j < len; j += ps) {
24-
if (series.datapoints.points[j] > posX) {
25-
break;
24+
// Special case of a non stepped line, highlight the very last point just before a null point
25+
if ((!series.lines.steps && series.datapoints.points[initial] != null && series.datapoints.points[j] == null)
26+
//normal case
27+
|| series.datapoints.points[j] > posX) {
28+
return Math.max(j - ps, 0)/ps;
2629
}
2730
}
28-
// Special case of a non stepped line, highlight the very last point just before a null point
29-
while(!series.lines.steps && series.datapoints.points[initial] != null && j>0 && series.datapoints.points[j-ps] == null) {
30-
j-=ps;
31-
}
32-
return Math.max(j - ps, 0)/ps;
31+
return j/ps - 1;
3332
};
3433

3534
this.findHoverIndexFromData = function(posX, series) {

0 commit comments

Comments
 (0)