minBarLength at base going both ways (#7642)

This commit is contained in:
Jukka Kurkela
2020-07-17 20:29:43 +03:00
committed by Evert Timberg
parent 117c2bdb10
commit 2cbcd8892f
13 changed files with 211 additions and 1 deletions

View File

@@ -409,7 +409,7 @@ export default class BarController extends DatasetController {
// So we don't try to draw so huge rectangles.
// https://github.com/chartjs/Chart.js/issues/5247
// TODO: use borderWidth instead (need to move the parsing from rectangle)
const base = _limitValue(vScale.getPixelForValue(start),
let base = _limitValue(vScale.getPixelForValue(start),
vScale._startPixel - 10,
vScale._endPixel + 10);
@@ -418,6 +418,9 @@ export default class BarController extends DatasetController {
if (minBarLength !== undefined && Math.abs(size) < minBarLength) {
size = size < 0 ? -minBarLength : minBarLength;
if (value === 0) {
base -= size / 2;
}
head = base + size;
}