From e44bcc0799e0e934d88200dd54d61e9367caec95 Mon Sep 17 00:00:00 2001 From: Ali Kazemkhanloo Date: Tue, 15 Dec 2020 20:50:03 +0330 Subject: [PATCH] fix rtl issue with x-axis --- packages/axes/src/compute.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/axes/src/compute.js b/packages/axes/src/compute.js index 106b06e390..e19c121915 100644 --- a/packages/axes/src/compute.js +++ b/packages/axes/src/compute.js @@ -138,6 +138,7 @@ export const computeCartesianTicks = ({ const line = { lineX: 0, lineY: 0 } const text = { textX: 0, textY: 0 } + const isRTL = document.dir === 'rtl' let translate let textAlign = textProps.align.center let textBaseline = textProps.baseline.center @@ -160,13 +161,13 @@ export const computeCartesianTicks = ({ (ticksPosition === 'after' && tickRotation < 0) || (ticksPosition === 'before' && tickRotation > 0) ) { - textAlign = textProps.align.right + textAlign = textProps.align[isRTL ? 'left' : 'right'] textBaseline = textProps.baseline.center } else if ( (ticksPosition === 'after' && tickRotation > 0) || (ticksPosition === 'before' && tickRotation < 0) ) { - textAlign = textProps.align.left + textAlign = textProps.align[isRTL ? 'right' : 'left'] textBaseline = textProps.baseline.center } } else {