From: Jukka Kurkela Date: Sat, 20 Feb 2021 18:06:40 +0000 (+0200) Subject: Disable fastPathSegment when data is decimated (#8465) X-Git-Tag: v3.0.0-beta.12~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=329b826b74c7b4ebf35117ee4f3ec5e093b8395f;p=thirdparty%2FChart.js.git Disable fastPathSegment when data is decimated (#8465) --- diff --git a/src/controllers/controller.line.js b/src/controllers/controller.line.js index 9cbd48aa6..e6245295c 100644 --- a/src/controllers/controller.line.js +++ b/src/controllers/controller.line.js @@ -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. diff --git a/src/elements/element.line.js b/src/elements/element.line.js index 3146adef9..e81811d59 100644 --- a/src/elements/element.line.js +++ b/src/elements/element.line.js @@ -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) {