]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Disable fastPathSegment when data is decimated (#8465)
authorJukka Kurkela <jukka.kurkela@gmail.com>
Sat, 20 Feb 2021 18:06:40 +0000 (20:06 +0200)
committerGitHub <noreply@github.com>
Sat, 20 Feb 2021 18:06:40 +0000 (13:06 -0500)
src/controllers/controller.line.js
src/elements/element.line.js

index 9cbd48aa63f5bd9b20c09d4e0dcc81779821b9cf..e6245295cd66180becaf994d14d60ffeaa99d3c1 100644 (file)
@@ -12,7 +12,7 @@ export default class LineController extends DatasetController {
   update(mode) {
     const me = this;
     const meta = me._cachedMeta;
-    const {dataset: line, data: points = []} = meta;
+    const {dataset: line, data: points = [], _dataset} = meta;
     // @ts-ignore
     const animationsDisabled = me.chart._animationsDisabled;
     let {start, count} = getStartAndCountOfVisiblePoints(meta, points, animationsDisabled);
@@ -26,6 +26,7 @@ export default class LineController extends DatasetController {
     }
 
     // Update Line
+    line._decimated = !!_dataset._decimated;
     line.points = points;
 
     // In resize mode only point locations change, so no need to set the options.
index 3146adef9d690d2638fbfb7ac49f247bcb144e21..e81811d5913ce66081367baccf6a64fe08335742 100644 (file)
@@ -179,7 +179,7 @@ function fastPathSegment(ctx, line, segment, params) {
 function _getSegmentMethod(line) {
   const opts = line.options;
   const borderDash = opts.borderDash && opts.borderDash.length;
-  const useFastPath = !line._loop && !opts.tension && !opts.stepped && !borderDash;
+  const useFastPath = !line._decimated && !line._loop && !opts.tension && !opts.stepped && !borderDash;
   return useFastPath ? fastPathSegment : pathSegment;
 }
 
@@ -231,6 +231,7 @@ export default class LineElement extends Element {
     this._path = undefined;
     this._points = undefined;
     this._segments = undefined;
+    this._decimated = false;
     this._pointsUpdated = false;
 
     if (cfg) {