From: Jukka Kurkela Date: Tue, 23 Mar 2021 12:28:38 +0000 (+0200) Subject: Line: update all points when scale range changes (#8703) X-Git-Tag: v3.0.0-rc.3~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=74f2f85ec3798e9d72c9b40aaac01aa4b4d8658e;p=thirdparty%2FChart.js.git Line: update all points when scale range changes (#8703) --- diff --git a/src/controllers/controller.line.js b/src/controllers/controller.line.js index 04670d151..85a20da81 100644 --- a/src/controllers/controller.line.js +++ b/src/controllers/controller.line.js @@ -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; } diff --git a/test/fixtures/plugin.filler/points-outside-canvas-initial.js b/test/fixtures/plugin.filler/points-outside-canvas-initial.js new file mode 100644 index 000000000..8349c808e --- /dev/null +++ b/test/fixtures/plugin.filler/points-outside-canvas-initial.js @@ -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 + } + } + } + }, +}; diff --git a/test/fixtures/plugin.filler/points-outside-canvas-initial.png b/test/fixtures/plugin.filler/points-outside-canvas-initial.png new file mode 100644 index 000000000..34f18a625 Binary files /dev/null and b/test/fixtures/plugin.filler/points-outside-canvas-initial.png differ diff --git a/test/fixtures/plugin.filler/points-outside-canvas-update.js b/test/fixtures/plugin.filler/points-outside-canvas-update.js new file mode 100644 index 000000000..61c0b38d5 --- /dev/null +++ b/test/fixtures/plugin.filler/points-outside-canvas-update.js @@ -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(); + } + } +}; diff --git a/test/fixtures/plugin.filler/points-outside-canvas-update.png b/test/fixtures/plugin.filler/points-outside-canvas-update.png new file mode 100644 index 000000000..1bb8b8748 Binary files /dev/null and b/test/fixtures/plugin.filler/points-outside-canvas-update.png differ