diff --git a/src/legends/ramp.js b/src/legends/ramp.js index f8422eed09..ebe9cbce64 100644 --- a/src/legends/ramp.js +++ b/src/legends/ramp.js @@ -149,14 +149,16 @@ export function legendRamp(color, { .attr("font-family", null) .attr("font-variant", impliedString(fontVariant, "normal")) .call(tickAdjust) - .call(g => g.select(".domain").remove()) - .call(label === undefined ? () => {} : g => g.append("text") - .attr("x", marginLeft) - .attr("y", marginTop + marginBottom - height - 6) - .attr("fill", "currentColor") // TODO move to stylesheet? - .attr("text-anchor", "start") - .attr("font-weight", "bold") - .text(label)); + .call(g => g.select(".domain").remove()); + + if (label !== undefined) { + svg.append("text") + .attr("x", marginLeft) + .attr("y", marginTop - 6) + .attr("fill", "currentColor") // TODO move to stylesheet? + .attr("font-weight", "bold") + .text(label); + } return svg.node(); } diff --git a/test/output/carsHexbin.html b/test/output/carsHexbin.html index 3814364763..41dd5fa93b 100644 --- a/test/output/carsHexbin.html +++ b/test/output/carsHexbin.html @@ -26,8 +26,8 @@ 5,000 - weight (lb) - + + weight (lb) \ No newline at end of file diff --git a/test/output/colorLegendDivergingSqrt.svg b/test/output/colorLegendDivergingSqrt.svg index 243e1bc5ae..0f88f9649c 100644 --- a/test/output/colorLegendDivergingSqrt.svg +++ b/test/output/colorLegendDivergingSqrt.svg @@ -29,6 +29,6 @@ +10% - Daily change - + + Daily change \ No newline at end of file diff --git a/test/output/colorLegendImplicitLabel.svg b/test/output/colorLegendImplicitLabel.svg index b796285b48..94ba7c13cd 100644 --- a/test/output/colorLegendImplicitLabel.svg +++ b/test/output/colorLegendImplicitLabel.svg @@ -29,6 +29,6 @@ 80 - thing - + + thing \ No newline at end of file diff --git a/test/output/colorLegendLabelBoth.svg b/test/output/colorLegendLabelBoth.svg index b4c17bca51..9dcdbc87eb 100644 --- a/test/output/colorLegendLabelBoth.svg +++ b/test/output/colorLegendLabelBoth.svg @@ -32,6 +32,6 @@ 10 - Legend - + + Legend \ No newline at end of file diff --git a/test/output/colorLegendLabelLegend.svg b/test/output/colorLegendLabelLegend.svg index b4c17bca51..9dcdbc87eb 100644 --- a/test/output/colorLegendLabelLegend.svg +++ b/test/output/colorLegendLabelLegend.svg @@ -32,6 +32,6 @@ 10 - Legend - + + Legend \ No newline at end of file diff --git a/test/output/colorLegendLabelScale.svg b/test/output/colorLegendLabelScale.svg index 760505caf9..ec93e9e2b2 100644 --- a/test/output/colorLegendLabelScale.svg +++ b/test/output/colorLegendLabelScale.svg @@ -32,6 +32,6 @@ 10 - Scale - + + Scale \ No newline at end of file diff --git a/test/output/colorLegendMargins.svg b/test/output/colorLegendMargins.svg index 66183dae2c..740549c65c 100644 --- a/test/output/colorLegendMargins.svg +++ b/test/output/colorLegendMargins.svg @@ -23,6 +23,6 @@ 10 - I feel blue - + + I feel blue \ No newline at end of file diff --git a/test/output/colorLegendOrdinalRampTickSize.svg b/test/output/colorLegendOrdinalRampTickSize.svg index c2dd064dd4..f2bafcefa4 100644 --- a/test/output/colorLegendOrdinalRampTickSize.svg +++ b/test/output/colorLegendOrdinalRampTickSize.svg @@ -43,6 +43,6 @@ ≥70 - Age (years) - + + Age (years) \ No newline at end of file diff --git a/test/output/colorLegendQuantile.svg b/test/output/colorLegendQuantile.svg index 27ce4ad61e..acd341ba27 100644 --- a/test/output/colorLegendQuantile.svg +++ b/test/output/colorLegendQuantile.svg @@ -40,6 +40,6 @@ 7,201 - Inferno - + + Inferno \ No newline at end of file diff --git a/test/output/colorLegendQuantileImplicit.svg b/test/output/colorLegendQuantileImplicit.svg index 27ce4ad61e..acd341ba27 100644 --- a/test/output/colorLegendQuantileImplicit.svg +++ b/test/output/colorLegendQuantileImplicit.svg @@ -40,6 +40,6 @@ 7,201 - Inferno - + + Inferno \ No newline at end of file diff --git a/test/output/colorLegendQuantize.svg b/test/output/colorLegendQuantize.svg index e76355d29a..82ba4d62b1 100644 --- a/test/output/colorLegendQuantize.svg +++ b/test/output/colorLegendQuantize.svg @@ -44,6 +44,6 @@ 140 - quantize scale - + + quantize scale \ No newline at end of file diff --git a/test/output/colorLegendQuantizeDescending.svg b/test/output/colorLegendQuantizeDescending.svg index c64497818f..c22a7f594c 100644 --- a/test/output/colorLegendQuantizeDescending.svg +++ b/test/output/colorLegendQuantizeDescending.svg @@ -44,6 +44,6 @@ 20 - quantize descending - + + quantize descending \ No newline at end of file diff --git a/test/output/colorLegendQuantizeDescendingReversed.svg b/test/output/colorLegendQuantizeDescendingReversed.svg index 43d0280436..e58b9b761f 100644 --- a/test/output/colorLegendQuantizeDescendingReversed.svg +++ b/test/output/colorLegendQuantizeDescendingReversed.svg @@ -32,6 +32,6 @@ 2 - quantize descending reversed - + + quantize descending reversed \ No newline at end of file diff --git a/test/output/colorLegendQuantizeRange.svg b/test/output/colorLegendQuantizeRange.svg index 2df4645bde..06839cb4e6 100644 --- a/test/output/colorLegendQuantizeRange.svg +++ b/test/output/colorLegendQuantizeRange.svg @@ -32,6 +32,6 @@ 115.4 - quantize scale - + + quantize scale \ No newline at end of file diff --git a/test/output/colorLegendQuantizeReverse.svg b/test/output/colorLegendQuantizeReverse.svg index 9bca5d64d8..e386aab98e 100644 --- a/test/output/colorLegendQuantizeReverse.svg +++ b/test/output/colorLegendQuantizeReverse.svg @@ -44,6 +44,6 @@ 80 - quantize reversed - + + quantize reversed \ No newline at end of file diff --git a/test/output/colorLegendThreshold.svg b/test/output/colorLegendThreshold.svg index 869606020c..ded6170848 100644 --- a/test/output/colorLegendThreshold.svg +++ b/test/output/colorLegendThreshold.svg @@ -52,6 +52,6 @@ 9 - Viridis - + + Viridis \ No newline at end of file diff --git a/test/output/colorLegendThresholdTickSize.svg b/test/output/colorLegendThresholdTickSize.svg index c55d1873a3..2e38da5e45 100644 --- a/test/output/colorLegendThresholdTickSize.svg +++ b/test/output/colorLegendThresholdTickSize.svg @@ -48,6 +48,6 @@ 9.5 - Unemployment rate (%) - + + Unemployment rate (%) \ No newline at end of file diff --git a/test/output/colorSchemesQuantitative.html b/test/output/colorSchemesQuantitative.html index aefa3ba581..80b1c4a154 100644 --- a/test/output/colorSchemesQuantitative.html +++ b/test/output/colorSchemesQuantitative.html @@ -14,7 +14,7 @@ } - brbg + brbg - prgn + prgn - piyg + piyg - puor + puor - rdbu + rdbu - rdgy + rdgy - rdylbu + rdylbu - rdylgn + rdylgn - spectral + spectral - burd + burd - buylrd + buylrd - blues + blues - greens + greens - greys + greys - purples + purples - reds + reds - oranges + oranges - turbo + turbo - viridis + viridis - magma + magma - inferno + inferno - plasma + plasma - cividis + cividis - cubehelix + cubehelix - warm + warm - cool + cool - bugn + bugn - bupu + bupu - gnbu + gnbu - orrd + orrd - pubugn + pubugn - pubu + pubu - purd + purd - rdpu + rdpu - ylgnbu + ylgnbu - ylgn + ylgn - ylorbr + ylorbr - ylorrd + ylorrd - rainbow + rainbow - sinebow + sinebow \ No newline at end of file diff --git a/test/output/hexbinR.html b/test/output/hexbinR.html index 6d10c759ea..1bf35141af 100644 --- a/test/output/hexbinR.html +++ b/test/output/hexbinR.html @@ -26,8 +26,8 @@ 15 - Proportion of each sex (%) - + + Proportion of each sex (%) \ No newline at end of file diff --git a/test/output/opacityLegendColor.svg b/test/output/opacityLegendColor.svg index 52b580b47c..b1d6f29ed7 100644 --- a/test/output/opacityLegendColor.svg +++ b/test/output/opacityLegendColor.svg @@ -32,6 +32,6 @@ 10 - Linear - + + Linear \ No newline at end of file diff --git a/test/output/opacityLegendLinear.svg b/test/output/opacityLegendLinear.svg index 04067ef3d7..983d9c22da 100644 --- a/test/output/opacityLegendLinear.svg +++ b/test/output/opacityLegendLinear.svg @@ -32,6 +32,6 @@ 10 - Linear - + + Linear \ No newline at end of file diff --git a/test/output/opacityLegendLog.svg b/test/output/opacityLegendLog.svg index 34acaf44e7..da36a834e7 100644 --- a/test/output/opacityLegendLog.svg +++ b/test/output/opacityLegendLog.svg @@ -44,6 +44,6 @@ 10 - Log - + + Log \ No newline at end of file diff --git a/test/output/opacityLegendRange.svg b/test/output/opacityLegendRange.svg index 2ba4991003..fe29b98f12 100644 --- a/test/output/opacityLegendRange.svg +++ b/test/output/opacityLegendRange.svg @@ -32,6 +32,6 @@ 1.0 - Range - + + Range \ No newline at end of file diff --git a/test/output/opacityLegendSqrt.svg b/test/output/opacityLegendSqrt.svg index 8ba88bebca..777c8c2387 100644 --- a/test/output/opacityLegendSqrt.svg +++ b/test/output/opacityLegendSqrt.svg @@ -32,6 +32,6 @@ 1.0 - Sqrt - + + Sqrt \ No newline at end of file diff --git a/test/output/simpsonsViews.html b/test/output/simpsonsViews.html index 3b3cf1e3f2..6aa92a6560 100644 --- a/test/output/simpsonsViews.html +++ b/test/output/simpsonsViews.html @@ -36,8 +36,8 @@ 25 - season - + + season