Skip to content

Commit 0034b6e

Browse files
author
benrubson
committed
Highlight correct point when series has null values
1 parent 1eb0ea3 commit 0034b6e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,13 @@ function ($) {
2222
var len = series.datapoints.points.length;
2323
for (var j = initial; j < len; j += ps) {
2424
if (series.datapoints.points[j] > posX) {
25-
return Math.max(j - ps, 0)/ps;
25+
break;
2626
}
2727
}
28-
return j/ps - 1;
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+
return Math.max(j - ps, 0)/ps;
2932
};
3033

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

0 commit comments

Comments
 (0)