Browse Source

initialize minDist to Infinity

pull/2476/head
Anthony Bell 6 years ago
parent
commit
b3cc67b38a
  1. 4
      src/data.js

4
src/data.js

@ -335,7 +335,7 @@ ChartInternal.prototype.horizontalDistance = function(data, pos) {
}; };
ChartInternal.prototype.findClosest = function (values, pos) { ChartInternal.prototype.findClosest = function (values, pos) {
var $$ = this, var $$ = this,
minDist, minDist = Infinity,
closest; closest;
// find mouseovering bar // find mouseovering bar
@ -353,7 +353,7 @@ ChartInternal.prototype.findClosest = function (values, pos) {
return v && !$$.isBarType(v.id); return v && !$$.isBarType(v.id);
}).forEach(function (v) { }).forEach(function (v) {
var d = $$.horizontalDistance(v, pos); var d = $$.horizontalDistance(v, pos);
if (d < minDist || !minDist) { if (d < minDist) {
minDist = d; minDist = d;
closest = v; closest = v;
} }

Loading…
Cancel
Save