-
Notifications
You must be signed in to change notification settings - Fork 313
Closed
Description
As in for bump charts. Like d3.linkHorizontal, but as a curve. Maybe d3.curveLinkHorizontal is a better name? Or d3.curveSankeyHorizontal? Here’s an implementation that works for lines:
function curveBump(context) {
let _point, _x, _y;
return {
lineStart() {
_point = 0;
},
lineEnd() {
_point = NaN;
},
point(x, y) {
if (++_point === 1) context.moveTo(x, y);
else _x = (_x + x) / 2, context.bezierCurveTo(_x, _y, _x, y, x, y);
_x = x, _y = y;
}
}
}
Metadata
Metadata
Assignees
Labels
No labels