update time scale range only for visible datasets

This commit is contained in:
Lighnat0r 2016-04-27 21:26:20 +02:00 committed by Lighnat0r
parent 450a08420b
commit 6b32466a19

View File

@ -104,6 +104,7 @@ module.exports = function(Chart) {
helpers.each(this.chart.data.datasets, function(dataset, datasetIndex) {
var momentsForDataset = [];
var datasetVisible = helpers.isDatasetVisible(dataset);
if (typeof dataset.data[0] === 'object') {
helpers.each(dataset.data, function(value, index) {
@ -115,10 +116,12 @@ module.exports = function(Chart) {
}
momentsForDataset.push(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 {
// We have no labels. Use the ones from the scale