From 6f95f129cfa746a2bcc5456ed5fe322d6e9273ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Rivi=C3=A8re?= Date: Sat, 19 Oct 2024 18:11:05 +0200 Subject: [PATCH] fix waffle stroke (when constant) --- src/marks/waffle.js | 2 +- test/output/waffleStroke.svg | 24 +- test/output/waffleStrokeMixed.svg | 12 +- test/output/waffleStrokeNegative.svg | 12 +- test/output/waffleStrokePositive.svg | 12 +- test/output/waffleStrokeWidth.svg | 346 +++++++++++++++++++++++++ test/output/waffleStrokeWidthConst.svg | 346 +++++++++++++++++++++++++ test/plots/waffle.ts | 14 + 8 files changed, 737 insertions(+), 31 deletions(-) create mode 100644 test/output/waffleStrokeWidth.svg create mode 100644 test/output/waffleStrokeWidthConst.svg diff --git a/src/marks/waffle.js b/src/marks/waffle.js index 883a4a1b14..8df8cd6fc5 100644 --- a/src/marks/waffle.js +++ b/src/marks/waffle.js @@ -104,7 +104,7 @@ function waffleRender(y) { .join("L")}Z` ) .attr("fill", (i) => `url(#${patternId}-${i})`) - .attr("stroke", this.stroke == null ? null : (i) => `url(#${patternId}-${i})`) + .attr("stroke", this.stroke == null ? null : "none") .call(applyChannelStyles, this, {ariaLabel, href, title}) ) .node(); diff --git a/test/output/waffleStroke.svg b/test/output/waffleStroke.svg index ff8bc9a54a..a5e317c71a 100644 --- a/test/output/waffleStroke.svg +++ b/test/output/waffleStroke.svg @@ -66,12 +66,12 @@ - - - - - - + + + + + + @@ -92,11 +92,11 @@ - - - - - - + + + + + + \ No newline at end of file diff --git a/test/output/waffleStrokeMixed.svg b/test/output/waffleStrokeMixed.svg index fceae2f5af..a8fe5022d4 100644 --- a/test/output/waffleStrokeMixed.svg +++ b/test/output/waffleStrokeMixed.svg @@ -70,12 +70,12 @@ - - - - - - + + + + + + diff --git a/test/output/waffleStrokeNegative.svg b/test/output/waffleStrokeNegative.svg index 8e03565a10..263cc64772 100644 --- a/test/output/waffleStrokeNegative.svg +++ b/test/output/waffleStrokeNegative.svg @@ -100,12 +100,12 @@ - - - - - - + + + + + + diff --git a/test/output/waffleStrokePositive.svg b/test/output/waffleStrokePositive.svg index cb2ab9cd2b..7e6499571f 100644 --- a/test/output/waffleStrokePositive.svg +++ b/test/output/waffleStrokePositive.svg @@ -100,12 +100,12 @@ - - - - - - + + + + + + diff --git a/test/output/waffleStrokeWidth.svg b/test/output/waffleStrokeWidth.svg new file mode 100644 index 0000000000..73458ca22b --- /dev/null +++ b/test/output/waffleStrokeWidth.svg @@ -0,0 +1,346 @@ + + + + + 0 + 10 + 20 + 30 + 40 + 50 + 60 + 70 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/output/waffleStrokeWidthConst.svg b/test/output/waffleStrokeWidthConst.svg new file mode 100644 index 0000000000..9d6b885897 --- /dev/null +++ b/test/output/waffleStrokeWidthConst.svg @@ -0,0 +1,346 @@ + + + + + 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 fdfa98a025..90122b5885 100644 --- a/test/plots/waffle.ts +++ b/test/plots/waffle.ts @@ -264,3 +264,17 @@ export function waffleHref() { ] }); } + +export function waffleStrokeWidth() { + return Plot.plot({ + inset: 10, + marks: [Plot.waffleY({length: 77}, {y: 1, stroke: (d, i) => i % 7, gap: 15, strokeWidth: 15, strokeOpacity: 0.8})] + }); +} + +export function waffleStrokeWidthConst() { + return Plot.plot({ + inset: 10, + marks: [Plot.waffleY({length: 77}, {y: 1, stroke: "black", gap: 15, strokeWidth: 15, strokeOpacity: 0.8})] + }); +}