Skip to content

Commit

Permalink
Disable fastPathSegment when data is decimated (#8465)
Browse files Browse the repository at this point in the history
  • Loading branch information
kurkle authored Feb 20, 2021
1 parent b467c0d commit 329b826
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/controllers/controller.line.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion src/elements/element.line.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 329b826

Please sign in to comment.