diff --git a/src/legends/swatches.js b/src/legends/swatches.js index e5876aa546..ca18749c5e 100644 --- a/src/legends/swatches.js +++ b/src/legends/swatches.js @@ -79,7 +79,10 @@ function legendItems(scale, options = {}, swatch) { swatchSize = 15, swatchWidth = swatchSize, swatchHeight = swatchSize, - marginLeft = 0, + marginTop, + marginBottom, + marginLeft, + marginRight, className, style, width @@ -153,7 +156,6 @@ function legendItems(scale, options = {}, swatch) { `.${className}-swatches { font-family: system-ui, sans-serif; font-size: 10px; - margin-bottom: 0.5em; } .${className}-swatch > svg { margin-right: 0.5em; @@ -162,6 +164,9 @@ function legendItems(scale, options = {}, swatch) { ${extraStyle}` ) ) + .style("margin-top", marginTop ? `${+marginTop}px` : null) + .style("margin-right", marginRight ? `${+marginRight}px` : null) + .style("margin-bottom", `${marginBottom === undefined ? "0.5em" : `${+marginBottom}px`}`) .style("margin-left", marginLeft ? `${+marginLeft}px` : null) .style("width", width === undefined ? null : `${+width}px`) .style("font-variant", impliedString(fontVariant, "normal")) diff --git a/test/output/athletesSortNationality.html b/test/output/athletesSortNationality.html index 15732dce20..846ce7d477 100644 --- a/test/output/athletesSortNationality.html +++ b/test/output/athletesSortNationality.html @@ -1,10 +1,9 @@
-
+