Add extra bucket when max outside range (#7264)

This commit is contained in:
Beto Dealmeida 2019-04-09 19:35:13 -07:00 committed by Christine Chambers
parent 05afe1b8c2
commit 984b04d1e5
1 changed files with 2 additions and 1 deletions

View File

@ -38,7 +38,8 @@ export function getBreakPoints({
const precision = delta === 0
? 0
: Math.max(0, Math.ceil(Math.log10(1 / delta)));
return Array(numBuckets + 1)
const extraBucket = maxValue > maxValue.toFixed(precision) ? 1 : 0;
return Array(numBuckets + 1 + extraBucket)
.fill()
.map((_, i) => (minValue + i * delta).toFixed(precision));
}