From 3f8d61f781244e36c5662ec59caf53ba234b9b2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Rivi=C3=A8re?= Date: Mon, 1 May 2023 13:44:26 -0700 Subject: [PATCH] axis dx and dy must be applied to the axis label too (note: conflicts with #1516, but the merge is trivial) --- src/marks/axis.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/marks/axis.js b/src/marks/axis.js index e9f7402445..8978d20975 100644 --- a/src/marks/axis.js +++ b/src/marks/axis.js @@ -145,8 +145,8 @@ function axisKy( this.frameAnchor = `${cla}-${anchor}`; this.rotate = 0; } - this.dy = cla === "top" ? 3 - marginTop : cla === "bottom" ? marginBottom - 3 : 0; - this.dx = anchor === "right" ? clo : -clo; + this.dy = (options.dy ?? 0) + (cla === "top" ? 3 - marginTop : cla === "bottom" ? marginBottom - 3 : 0); + this.dx = (options.dx ?? 0) + (anchor === "right" ? clo : -clo); this.ariaLabel = `${k}-axis label`; return { facets: [[0]], @@ -245,8 +245,8 @@ function axisKx( this.textAnchor = cla === "right" ? "end" : "start"; } this.lineAnchor = anchor; - this.dy = anchor === "top" ? -clo : clo; - this.dx = cla === "right" ? marginRight - 3 : cla === "left" ? 3 - marginLeft : 0; + this.dy = (options.dy ?? 0) + (anchor === "top" ? -clo : clo); + this.dx = (options.dx ?? 0) + (cla === "right" ? marginRight - 3 : cla === "left" ? 3 - marginLeft : 0); this.ariaLabel = `${k}-axis label`; return { facets: [[0]],