Skip to content

Commit 92b04e1

Browse files
committed
closed path smoothing for scatter lines
1 parent 3bc66f0 commit 92b04e1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/traces/scatter/plot.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,15 @@ module.exports = function plot(gd, plotinfo, cdscatter) {
9595
}
9696
else if(line.shape === 'spline') {
9797
pathfn = revpathbase = function(pts) {
98-
return Drawing.smoothopen(pts, line.smoothing);
98+
var pLast = pts[pts.length - 1];
99+
if(pts[0][0] === pLast[0] && pts[0][1] === pLast[1]) {
100+
// identical start and end points: treat it as a
101+
// closed curve so we don't get a kink
102+
return Drawing.smoothclosed(pts.slice(1), line.smoothing);
103+
}
104+
else {
105+
return Drawing.smoothopen(pts, line.smoothing);
106+
}
99107
};
100108
}
101109
else {

0 commit comments

Comments
 (0)