|
|
@ -352,6 +352,23 @@ Core.prototype.clear = function(what) { |
|
|
|
* for the animation. Default duration is 500 ms. |
|
|
|
*/ |
|
|
|
Core.prototype.fit = function(options) { |
|
|
|
var range = this._getDataRange(); |
|
|
|
|
|
|
|
// skip range set if there is no start and end date
|
|
|
|
if (range.start === null && range.end === null) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
var animate = (options && options.animate !== undefined) ? options.animate : true; |
|
|
|
this.range.setRange(range.start, range.end, animate); |
|
|
|
}; |
|
|
|
|
|
|
|
/** |
|
|
|
* Calculate the data range of the items and applies a 5% window around it. |
|
|
|
* @returns {{start: Date | null, end: Date | null}} |
|
|
|
* @protected |
|
|
|
*/ |
|
|
|
Core.prototype._getDataRange = function() { |
|
|
|
// apply the data range as range
|
|
|
|
var dataRange = this.getItemRange(); |
|
|
|
|
|
|
@ -368,13 +385,10 @@ Core.prototype.fit = function(options) { |
|
|
|
end = new Date(end.valueOf() + interval * 0.05); |
|
|
|
} |
|
|
|
|
|
|
|
// skip range set if there is no start and end date
|
|
|
|
if (start === null && end === null) { |
|
|
|
return; |
|
|
|
return { |
|
|
|
start: start, |
|
|
|
end: end |
|
|
|
} |
|
|
|
|
|
|
|
var animate = (options && options.animate !== undefined) ? options.animate : true; |
|
|
|
this.range.setRange(start, end, animate); |
|
|
|
}; |
|
|
|
|
|
|
|
/** |
|
|
|