Skip to content

Commit d00c663

Browse files
committed
fixes #5036; fix last datalabel outside of chart bounds
1 parent abafe95 commit d00c663

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/modules/DataLabels.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,14 @@ class DataLabels {
284284
}
285285

286286
if (correctedLabels.drawnextLabel) {
287+
if (textAnchor === 'middle') {
288+
if (x === w.globals.gridWidth) {
289+
// last label - might get cropped
290+
// fixes https://github.com/apexcharts/apexcharts.js/issues/5036
291+
textAnchor = 'end'
292+
}
293+
}
294+
287295
dataLabelText = graphics.drawText({
288296
width: 100,
289297
height: parseInt(dataLabelsConfig.style.fontSize, 10),

0 commit comments

Comments
 (0)