You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
When setting the parent position to top, it works correctly in LTR layouts. However, in RTL layouts, the parent label is incorrectly positioned outside the cell and appears on the left side instead of the right (it should appear on the right with sufficient padding).
LTR layout:
RTL layout:
Describe the solution you'd like
Providing additional options for the parentLabelPosition property to support values like top-left, top-right, and top-center would fit for both layouts. Alternatively, ensuring the text aligns with the starting edge of the cell automatically also would solve the issue.
Describe alternatives you've considered
As a workaround, I manually adjusted the x attribute of the text node (in RTL layout) to align with the cell's starting position using the following code in a React application:
constchartRef=useRef();useEffect(()=>{if(direction!=="rtl"){return;}functionhandleResize(){if(!chartRef.current){return;}// Adjust parent label positions inside the SVGconstparentLabels=chartRef.current.querySelectorAll('[data-testid^="parentLabel"]');parentLabels.forEach((label)=>{constsiblingWidth=label.previousElementSibling.getAttribute("width");label.setAttribute("x",siblingWidth);});}// Recalculate text node positions on window resize with debounceconstdebouncedResizeHandler=debounce(handleResize,600);window.addEventListener("resize",debouncedResizeHandler);// Initial adjustment delay to allow DOM updatessetTimeout(handleResize,20);return()=>{window.removeEventListener("resize",debouncedResizeHandler);};},[direction]);
Is your feature request related to a problem? Please describe.
When setting the parent position to
top
, it works correctly in LTR layouts. However, in RTL layouts, the parent label is incorrectly positioned outside the cell and appears on the left side instead of the right (it should appear on the right with sufficient padding).LTR layout:
RTL layout:
Describe the solution you'd like
Providing additional options for the
parentLabelPosition
property to support values liketop-left
,top-right
, andtop-center
would fit for both layouts. Alternatively, ensuring the text aligns with the starting edge of the cell automatically also would solve the issue.Describe alternatives you've considered
As a workaround, I manually adjusted the
x
attribute of thetext
node (in RTL layout) to align with the cell's starting position using the following code in a React application:While this workaround positions the labels correctly, it has limitations:
Additional context
With the workaround applied, the labels are correctly positioned as shown below:
The text was updated successfully, but these errors were encountered: