Skip to content

Commit a90580f

Browse files
Filmbostock
authored andcommitted
strokeWidth as a channel
closes #311
1 parent b2d1553 commit a90580f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/marks/link.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ export class Link extends Mark {
1616
title,
1717
stroke,
1818
strokeOpacity,
19+
strokeWidth,
1920
...options
2021
} = {}
2122
) {
2223
const [vstroke, cstroke] = maybeColor(stroke, "currentColor");
2324
const [vstrokeOpacity, cstrokeOpacity] = maybeNumber(strokeOpacity);
25+
const [vstrokeWidth, cstrokeWidth] = maybeNumber(strokeWidth, 1);
2426
super(
2527
data,
2628
[
@@ -31,20 +33,22 @@ export class Link extends Mark {
3133
{name: "z", value: z, optional: true},
3234
{name: "title", value: title, optional: true},
3335
{name: "stroke", value: vstroke, scale: "color", optional: true},
34-
{name: "strokeOpacity", value: vstrokeOpacity, scale: "opacity", optional: true}
36+
{name: "strokeOpacity", value: vstrokeOpacity, scale: "opacity", optional: true},
37+
{name: "strokeWidth", value: vstrokeWidth, optional: true},
3538
],
3639
options
3740
);
3841
Style(this, {
3942
stroke: cstroke,
4043
strokeOpacity: cstrokeOpacity,
44+
strokeWidth: cstrokeWidth,
4145
...options
4246
});
4347
}
4448
render(
4549
I,
4650
{x, y},
47-
{x1: X1, y1: Y1, x2: X2, y2: Y2, z: Z, title: L, stroke: S, strokeOpacity: SO}
51+
{x1: X1, y1: Y1, x2: X2, y2: Y2, z: Z, title: L, stroke: S, strokeOpacity: SO, strokeWidth: SW}
4852
) {
4953
const index = filter(I, X1, Y1, X2, Y2, S, SO);
5054
if (Z) index.sort((i, j) => ascending(Z[i], Z[j]));
@@ -61,6 +65,7 @@ export class Link extends Mark {
6165
.attr("y2", i => Y2[i])
6266
.call(applyAttr, "stroke", S && (i => S[i]))
6367
.call(applyAttr, "stroke-opacity", SO && (i => SO[i]))
68+
.call(applyAttr, "stroke-width", SW && (i => SW[i]))
6469
.call(title(L)))
6570
.node();
6671
}

0 commit comments

Comments
 (0)