From cf6ae71ade938ae8501be640c7ad2b512b621e52 Mon Sep 17 00:00:00 2001 From: Varun Chawla Date: Sun, 22 Feb 2026 19:56:05 -0800 Subject: [PATCH] fix: prevent crossAlign 'far' ticks from overlapping Y axis title When crossAlign is set to 'far' on Y axes, tick labels were drawn at this.left/this.right, which overlaps with the axis title area. Now accounts for the title height when positioning 'far'-aligned ticks, keeping them within the tick label area. Fixes #12095 --- src/core/core.scale.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/core.scale.js b/src/core/core.scale.js index e81b6b933bf..d5e4d77cc9f 100644 --- a/src/core/core.scale.js +++ b/src/core/core.scale.js @@ -1350,7 +1350,7 @@ export default class Scale extends Element { } _getYAxisLabelAlignment(tl) { - const {position, ticks: {crossAlign, mirror, padding}} = this.options; + const {position, ticks: {crossAlign, mirror, padding}, title: titleOpts} = this.options; const labelSizes = this._getLabelSizes(); const tickAndPadding = tl + padding; const widest = labelSizes.widest.width; @@ -1379,6 +1379,9 @@ export default class Scale extends Element { } else if (crossAlign === 'center') { textAlign = 'center'; x -= (widest / 2); + } else if (crossAlign === 'far') { + textAlign = 'left'; + x = this.left + getTitleHeight(titleOpts, this.chart.options.font); } else { textAlign = 'left'; x = this.left; @@ -1405,6 +1408,9 @@ export default class Scale extends Element { } else if (crossAlign === 'center') { textAlign = 'center'; x += widest / 2; + } else if (crossAlign === 'far') { + textAlign = 'right'; + x = this.right - getTitleHeight(titleOpts, this.chart.options.font); } else { textAlign = 'right'; x = this.right;