mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
Ensure tickUnit and displayFormat set before format loop
This commit is contained in:
parent
4c79c5756f
commit
e24406fc9d
@ -103,9 +103,12 @@
|
||||
var labelCapacity = innerWidth / this.options.ticks.fontSize + 4;
|
||||
var buffer = this.options.time.round ? 0 : 2;
|
||||
|
||||
this.tickRange = Math.ceil(this.lastTick.diff(this.firstTick, true) + buffer);
|
||||
var done;
|
||||
// Start as small as possible
|
||||
this.tickUnit = 'millisecond';
|
||||
this.tickRange = Math.ceil(this.lastTick.diff(this.firstTick, this.tickUnit, true) + buffer);
|
||||
this.displayFormat = time.unit[this.tickUnit].display;
|
||||
|
||||
// Work our way up to comfort
|
||||
helpers.each(time.units, function(format) {
|
||||
if (this.tickRange <= labelCapacity) {
|
||||
return;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user