diff --git a/src/marks/waffle.js b/src/marks/waffle.js index c9d8771d21..c7ced9c36f 100644 --- a/src/marks/waffle.js +++ b/src/marks/waffle.js @@ -34,8 +34,8 @@ export class WaffleY extends BarY { } function waffleRender(y) { - return function (index, scales, values, dimensions, context) { const {unit, gap, rx, ry, round} = this; + return function (index, scales, {href, ...values}, dimensions, context) { const {document} = context; const Y1 = values.channels[`${y}1`].value; const Y2 = values.channels[`${y}2`].value; @@ -104,6 +104,7 @@ function waffleRender(y) { ) .attr("fill", (i) => `url(#${patternId}-${i})`) .attr("stroke", this.stroke == null ? null : (i) => `url(#${patternId}-${i})`) + .call(applyChannelStyles, this, {href}) ) .node(); }; diff --git a/test/output/waffleHref.svg b/test/output/waffleHref.svg new file mode 100644 index 0000000000..0117ade5f9 --- /dev/null +++ b/test/output/waffleHref.svg @@ -0,0 +1,423 @@ + + + + + 0 + 10 + 20 + 30 + 40 + 50 + 60 + 70 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/plots/waffle.ts b/test/plots/waffle.ts index 455efd3a4a..933619b9fc 100644 --- a/test/plots/waffle.ts +++ b/test/plots/waffle.ts @@ -246,3 +246,20 @@ export async function waffleYGrouped() { marks: [Plot.waffleY(athletes, Plot.groupX({y: "count"}, {x: "sport", unit: 10})), Plot.ruleY([0])] }); } + +export function waffleHref() { + return Plot.plot({ + inset: 10, + marks: [ + Plot.waffleY( + {length: 77}, + { + y: 1, + fill: (d, i) => i % 7, + href: (d, i) => `/?${i}`, + target: "_blank" + } + ) + ] + }); +}