Recalculate the size of the scale in units when the end point is changed.

This commit is contained in:
Evert Timberg 2016-07-30 11:06:13 -04:00
parent 7628d4c8f2
commit 0bb2e478db

View File

@ -244,10 +244,15 @@ module.exports = function(Chart) {
// Only round the last tick if we have no hard maximum
if (!me.options.time.max) {
var roundedEnd = me.getMomentStartOf(me.lastTick);
if (roundedEnd.diff(me.lastTick, me.tickUnit, true) !== 0) {
var delta = roundedEnd.diff(me.lastTick, me.tickUnit, true);
if (delta < 0) {
// Do not use end of because we need me to be in the next time unit
me.lastTick = me.getMomentStartOf(me.lastTick.add(1, me.tickUnit));
} else if (delta >= 0) {
me.lastTick = roundedEnd;
}
me.scaleSizeInUnits = me.lastTick.diff(me.firstTick, me.tickUnit, true)
}
me.smallestLabelSeparation = me.width;