Line: update all points when scale range changes (#8703)

This commit is contained in:
Jukka Kurkela 2021-03-23 14:28:38 +02:00 committed by GitHub
parent 8ed689877f
commit 74f2f85ec3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 64 additions and 1 deletions

View File

@ -20,7 +20,7 @@ export default class LineController extends DatasetController {
me._drawStart = start;
me._drawCount = count;
if (scaleRangesChanged(meta) && !animationsDisabled) {
if (scaleRangesChanged(meta)) {
start = 0;
count = points.length;
}

View File

@ -0,0 +1,29 @@
module.exports = {
description: 'https://github.com/chartjs/Chart.js/issues/8699',
config: {
type: 'line',
data: {
datasets: [{
backgroundColor: 'red',
data: [{x: 0, y: 3}, {x: 2, y: -3}, {x: 4, y: 0}, {x: 6, y: 5}, {x: 8, y: -5}, {x: 10, y: 0}],
fill: 'origin'
}]
},
options: {
plugins: {
legend: false,
title: false,
},
scales: {
x: {
display: false,
type: 'linear',
min: 5
},
y: {
display: false
}
}
}
},
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -0,0 +1,34 @@
module.exports = {
description: 'https://github.com/chartjs/Chart.js/issues/8699',
config: {
type: 'line',
data: {
datasets: [{
backgroundColor: 'red',
data: [{x: 0, y: 3}, {x: 2, y: -3}, {x: 4, y: 0}, {x: 6, y: 5}, {x: 8, y: -5}, {x: 10, y: 0}],
fill: 'origin'
}]
},
options: {
plugins: {
legend: false,
title: false,
},
scales: {
x: {
type: 'linear',
display: false
},
y: {
display: false
}
}
}
},
options: {
run(chart) {
chart.scales.x.options.min = 5;
chart.update();
}
}
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB