Skip to content

Commit c17b9bc

Browse files
committed
fix the underlying problem that led to #970
even though it's hard to actually trigger it now that we're using gradients for continuous colorscales (would require a very dense contour set colored by fills)
1 parent 71e0c55 commit c17b9bc

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/components/colorbar/draw.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,12 @@ module.exports = function draw(gd, id) {
367367
.classed(cn.cbfill, true)
368368
.style('stroke', 'none');
369369
fills.exit().remove();
370+
371+
var zBounds = zrange
372+
.map(cbAxisOut.c2p)
373+
.map(Math.round)
374+
.sort(function(a, b) { return a - b; });
375+
370376
fills.each(function(d, i) {
371377
var z = [
372378
(i === 0) ? zrange[0] :
@@ -379,9 +385,7 @@ module.exports = function draw(gd, id) {
379385

380386
// offset the side adjoining the next rectangle so they
381387
// overlap, to prevent antialiasing gaps
382-
if(i !== filllevels.length - 1) {
383-
z[1] += (z[1] > z[0]) ? 1 : -1;
384-
}
388+
z[1] = Lib.constrain(z[1] + (z[1] > z[0]) ? 1 : -1, zBounds[0], zBounds[1]);
385389

386390
// Colorbar cannot currently support opacities so we
387391
// use an opaque fill even when alpha channels present

0 commit comments

Comments
 (0)