Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- infinite loop in generating time axis, due to insufficient bounds checking.
  • Loading branch information
jcopperfield authored and etimberg committed Dec 14, 2017
1 parent 95fe20a commit 99f57be
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/scales/scale.time.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ function determineStepSize(min, max, unit, capacity) {
var i, ilen, factor;

if (!steps) {
return Math.ceil(range / ((capacity || 1) * milliseconds));
return Math.ceil(range / (capacity * milliseconds));
}

for (i = 0, ilen = steps.length; i < ilen; ++i) {
Expand Down Expand Up @@ -748,7 +748,8 @@ module.exports = function(Chart) {
var tickLabelWidth = me.getLabelWidth(exampleLabel);
var innerWidth = me.isHorizontal() ? me.width : me.height;

return Math.floor(innerWidth / tickLabelWidth);
var capacity = Math.floor(innerWidth / tickLabelWidth);
return capacity > 0 ? capacity : 1;
}
});

Expand Down

0 comments on commit 99f57be

Please sign in to comment.