Skip to content

Commit

Permalink
Apply lineJoin style at the first point in radar charts (chartjs#6269)
Browse files Browse the repository at this point in the history
  • Loading branch information
nagix authored and simonbrunel committed May 20, 2019
1 parent 9585024 commit 73f62a9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 592 deletions.
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));
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

0 comments on commit 73f62a9

Please sign in to comment.