Skip to content

Commit fd7526b

Browse files
committed
edge case in autoShiftNumericBins
avoid an empty bin at the start. Tested via histogram_test
1 parent 9c0dea0 commit fd7526b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/plots/cartesian/axes.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,9 @@ function autoShiftNumericBins(binStart, data, ax, dataMin, dataMax) {
609609
// otherwise start half an integer down regardless of
610610
// the bin size, just enough to clear up endpoint
611611
// ambiguity about which integers are in which bins.
612-
else binStart -= 0.5;
612+
else {
613+
binStart += (binStart + 0.5 < dataMin) ? 0.5 : -0.5;
614+
}
613615
}
614616
else if(midcount < dataCount * 0.1) {
615617
if(edgecount > dataCount * 0.3 ||

0 commit comments

Comments
 (0)