Highlight correct point when series has null values

This commit is contained in:
benrubson 2016-11-18 18:49:20 +01:00
parent 1eb0ea3450
commit 0034b6ede7

View File

@ -22,10 +22,13 @@ function ($) {
var len = series.datapoints.points.length; var len = series.datapoints.points.length;
for (var j = initial; j < len; j += ps) { for (var j = initial; j < len; j += ps) {
if (series.datapoints.points[j] > posX) { if (series.datapoints.points[j] > posX) {
break;
}
}
// Special case of a non stepped line, highlight the very last point just before a null point
while(!series.lines.steps && series.datapoints.points[initial] != null && j>0 && series.datapoints.points[j-ps] == null)
j-=ps;
return Math.max(j - ps, 0)/ps; return Math.max(j - ps, 0)/ps;
}
}
return j/ps - 1;
}; };
this.findHoverIndexFromData = function(posX, series) { this.findHoverIndexFromData = function(posX, series) {