Minifying Pull Request #111

master-patched
Bob Monteverde 12 years ago
parent eb1407a39a
commit bcd7c85841

@ -7053,11 +7053,22 @@ nv.models.sparklinePlus = function() {
.attr('transform', function(d) { return 'translate(' + (pos - 6) + ',' + (-margin.top) + ')' })
//.text(xTickFormat(pos));
.text(xTickFormat(Math.round(x.invert(pos)))); //TODO: refactor this line
var f = function(data, x){
var distance = Math.abs(getX(data[0]) - x) ;
var closestIndex = 0;
for (var i = 0; i < data.length; i++){
if (Math.abs(getX(data[i]) - x) < distance) {
distance = Math.abs(getX(data[i]) -x);
closestIndex = i;
}
}
return closestIndex;
}
hoverY
.attr('transform', function(d) { return 'translate(' + (pos + 6) + ',' + (-margin.top) + ')' })
//.text(data[pos] && yTickFormat(data[pos].y));
.text(yTickFormat(getY(data[Math.round(x.invert(pos))]))); //TODO: refactor this line
.text(yTickFormat(getY(data[f(data, Math.round(x.invert(pos)))]))); //TODO: refactor this line
}
});

2
nv.d3.min.js vendored

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save