mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-07 04:39:06 +02:00
Merge pull request #3064 from chartjs/fix/2560
Recalculate the size of the scale in units when the end point is chan…
This commit is contained in:
commit
cec8d8b7d5
@ -244,10 +244,15 @@ module.exports = function(Chart) {
|
|||||||
// Only round the last tick if we have no hard maximum
|
// Only round the last tick if we have no hard maximum
|
||||||
if (!me.options.time.max) {
|
if (!me.options.time.max) {
|
||||||
var roundedEnd = me.getMomentStartOf(me.lastTick);
|
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
|
// 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));
|
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;
|
me.smallestLabelSeparation = me.width;
|
||||||
|
Loading…
Reference in New Issue
Block a user