mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
Merge pull request #2394 from Lighnat0r/master
Update time scale range only for visible datasets
This commit is contained in:
commit
6abc9a9020
@ -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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user