Skip to content

Commit 01cbde4

Browse files
committed
fixes #5040; improve calc to prevent cropping of 1st bar
1 parent bb0a27e commit 01cbde4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/charts/Bar.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,12 @@ class Bar {
380380

381381
if (!w.globals.isBarHorizontal) {
382382
if (
383-
dataLabelsObj.dataLabelsPos.dataLabelsX + barWidth < 0 ||
384-
dataLabelsObj.dataLabelsPos.dataLabelsX - barWidth > w.globals.gridWidth
383+
dataLabelsObj.dataLabelsPos.dataLabelsX +
384+
Math.max(barWidth, w.globals.barPadForNumericAxis) <
385+
0 ||
386+
dataLabelsObj.dataLabelsPos.dataLabelsX -
387+
Math.max(barWidth, w.globals.barPadForNumericAxis) >
388+
w.globals.gridWidth
385389
) {
386390
skipDrawing = true
387391
}

0 commit comments

Comments
 (0)