Skip to content

Commit

Permalink
Fixes issue chartjs#3585. Added check for 0 (otherwise would attempt …
Browse files Browse the repository at this point in the history
…to take log of 0, resulting in no bars drawn)
  • Loading branch information
jeffcarey committed Nov 17, 2016
1 parent bb71f69 commit 7d6b6d0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/scales/scale.logarithmic.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,13 @@ module.exports = function(Chart) {
pixel = me.top + paddingTop + innerDimension * 0.02 + (innerDimension * 0.98/ range * (helpers.log10(newVal)-helpers.log10(me.minNotZero)));
}
} else {
range = helpers.log10(me.end) - helpers.log10(start);
innerDimension = me.height - (paddingTop + paddingBottom);
pixel = (me.bottom - paddingBottom) - (innerDimension / range * (helpers.log10(newVal) - helpers.log10(start)));
if (newVal === 0) {
pixel = me.bottom - paddingBottom;
} else {
range = helpers.log10(me.end) - helpers.log10(start);
innerDimension = me.height - (paddingTop + paddingBottom);
pixel = (me.bottom - paddingBottom) - (innerDimension / range * ( helpers.log10(newVal) - helpers.log10(start)));
}
}
}
return pixel;
Expand Down

0 comments on commit 7d6b6d0

Please sign in to comment.