mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
Only generate ticks we care about
Instead of cloning `me.scaleSizeInUnits` moments and probably throwing the vast majority away, only clone what we need.
This commit is contained in:
parent
312773ba7b
commit
c20e57bc8a
@ -324,7 +324,7 @@ module.exports = function(Chart) {
|
||||
me.ticks.push(me.firstTick.clone());
|
||||
|
||||
// For every unit in between the first and last moment, create a moment and add it to the ticks tick
|
||||
for (var i = 1; i <= me.scaleSizeInUnits; ++i) {
|
||||
for (var i = me.unitScale; i <= me.scaleSizeInUnits; i += me.unitScale) {
|
||||
var newTick = roundedStart.clone().add(i, me.tickUnit);
|
||||
|
||||
// Are we greater than the max time
|
||||
@ -332,9 +332,7 @@ module.exports = function(Chart) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (i % me.unitScale === 0) {
|
||||
me.ticks.push(newTick);
|
||||
}
|
||||
me.ticks.push(newTick);
|
||||
}
|
||||
|
||||
// Always show the right tick
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user