]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Line: update all points when scale range changes (#8703)
authorJukka Kurkela <jukka.kurkela@gmail.com>
Tue, 23 Mar 2021 12:28:38 +0000 (14:28 +0200)
committerGitHub <noreply@github.com>
Tue, 23 Mar 2021 12:28:38 +0000 (08:28 -0400)
src/controllers/controller.line.js
test/fixtures/plugin.filler/points-outside-canvas-initial.js [new file with mode: 0644]
test/fixtures/plugin.filler/points-outside-canvas-initial.png [new file with mode: 0644]
test/fixtures/plugin.filler/points-outside-canvas-update.js [new file with mode: 0644]
test/fixtures/plugin.filler/points-outside-canvas-update.png [new file with mode: 0644]

index 04670d151475fa15cb296705e81a8678efbe8f6a..85a20da81a729999e8b246390bdcd362c326b367 100644 (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;
     }
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 (file)
index 0000000..8349c80
--- /dev/null
@@ -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 (file)
index 0000000..34f18a6
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 (file)
index 0000000..61c0b38
--- /dev/null
@@ -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 (file)
index 0000000..1bb8b87
Binary files /dev/null and b/test/fixtures/plugin.filler/points-outside-canvas-update.png differ