mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-07 04:39:06 +02:00
update time scale range only for visible datasets
This commit is contained in:
parent
450a08420b
commit
6b32466a19
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user