From 195cace7c215ec90ae29d2a90ac439ba5c2595f8 Mon Sep 17 00:00:00 2001 From: Lighnat0r Date: Wed, 27 Apr 2016 21:26:20 +0200 Subject: [PATCH 1/3] update time scale range only for visible datasets --- src/scales/scale.time.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/scales/scale.time.js b/src/scales/scale.time.js index 45ce64b43..f8064a8e3 100644 --- a/src/scales/scale.time.js +++ b/src/scales/scale.time.js @@ -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,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 { From 6b32466a1970d013a1aa6a422fb076586218fec5 Mon Sep 17 00:00:00 2001 From: Lighnat0r Date: Wed, 27 Apr 2016 21:26:20 +0200 Subject: [PATCH 2/3] update time scale range only for visible datasets --- src/scales/scale.time.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/scales/scale.time.js b/src/scales/scale.time.js index 620eac88c..af5bb8922 100644 --- a/src/scales/scale.time.js +++ b/src/scales/scale.time.js @@ -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,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 { From 200abc184ba8a9ff1a5ac091e10fd024690392fb Mon Sep 17 00:00:00 2001 From: Lighnat0r Date: Wed, 27 Apr 2016 23:18:03 +0200 Subject: [PATCH 3/3] update isDatasetVisible call --- src/scales/scale.time.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scales/scale.time.js b/src/scales/scale.time.js index af5bb8922..860bccaad 100644 --- a/src/scales/scale.time.js +++ b/src/scales/scale.time.js @@ -104,7 +104,7 @@ module.exports = function(Chart) { helpers.each(this.chart.data.datasets, function(dataset, datasetIndex) { var momentsForDataset = []; - var datasetVisible = helpers.isDatasetVisible(dataset); + var datasetVisible = this.chart.isDatasetVisible(datasetIndex); if (typeof dataset.data[0] === 'object') { helpers.each(dataset.data, function(value, index) {