Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply lineJoin style at the first point in radar charts #6269

Merged
merged 2 commits into from May 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 19 additions & 2 deletions src/elements/element.line.js
Expand Up @@ -37,11 +37,24 @@ module.exports = Element.extend({
var globalDefaults = defaults.global;
var globalOptionLineElements = globalDefaults.elements.line;
var lastDrawnIndex = -1;
var closePath = me._loop;
var index, current, previous, currentVM;

// If we are looping, adding the first point again
if (me._loop && points.length) {
points.push(points[0]);
if (!spanGaps) {
for (index = points.length - 1; index >= 0; --index) {
// If the line has an open path, shift the point array
if (points[index]._view.skip) {
points = points.slice(index).concat(points.slice(0, index));
simonbrunel marked this conversation as resolved.
Show resolved Hide resolved
closePath = false;
break;
}
}
}
// If the line has a close path, add the first point again
if (closePath) {
points.push(points[0]);
}
}

ctx.save();
Expand Down Expand Up @@ -90,6 +103,10 @@ module.exports = Element.extend({
}
}

if (closePath) {
ctx.closePath();
}

ctx.stroke();
ctx.restore();
}
Expand Down