Merge pull request #2394 from Lighnat0r/master

Update time scale range only for visible datasets
This commit is contained in:
Evert Timberg 2016-04-27 17:24:23 -04:00
commit 6abc9a9020

View File

@ -104,6 +104,7 @@ module.exports = function(Chart) {
helpers.each(this.chart.data.datasets, function(dataset, datasetIndex) {
var momentsForDataset = [];
var datasetVisible = this.chart.isDatasetVisible(datasetIndex);
if (typeof dataset.data[0] === 'object') {
helpers.each(dataset.data, function(value, index) {
@ -115,9 +116,11 @@ module.exports = function(Chart) {
}
momentsForDataset.push(labelMoment);
// May have gone outside the scale ranges, make sure we keep the first and last ticks updated
this.firstTick = this.firstTick !== null ? moment.min(this.firstTick, labelMoment) : labelMoment;
this.lastTick = this.lastTick !== null ? moment.max(this.lastTick, labelMoment) : labelMoment;
if (datasetVisible) {
// May have gone outside the scale ranges, make sure we keep the first and last ticks updated
this.firstTick = this.firstTick !== null ? moment.min(this.firstTick, labelMoment) : labelMoment;
this.lastTick = this.lastTick !== null ? moment.max(this.lastTick, labelMoment) : labelMoment;
}
}
}, this);
} else {