[Bug] RTL text issues and inconsistencies between Canvas and SVG renderers
- Dominant language
- TypeScript
- Stars
- 67.3k
- Forks
- 19.8k
- Avg merge
- 11d 14h
- Merged PRs (30d)
- 8
Description
### Version
6.0.0
### Link to Minimal Reproduction
https://codepen.io/CheeryMental/pen/gbMwdeo https://codepen.io/CheeryMental/pen/YPWGOLV
### Steps to Reproduce
**Case 1: Canvas renderer + dir="auto" (incorrect initial RTL render with direction-neutral characters)**
Create an ECharts chart using the Canvas renderer.
Use Arabic / RTL text in axis labels.
Include direction-neutral characters in the label text (e.g. parentheses ( )).
Example: Arabic text containing brackets.
Set the chart container direction to dir="auto".
Load the chart page.
Observe the initial render of RTL labels.
Interact with the chart (hover, resize, tooltip, zoom, etc.).
**Reproduction**:
https://codepen.io/CheeryMental/pen/gbMwdeo
**Case 2: SVG renderer + RTL (dir="rtl", labels overlap axis)**
Create an ECharts chart using the SVG renderer.
Use Arabic / RTL text in axis labels.
Set the chart container direction explicitly to dir="rtl".
Render the chart
Observe how labels are positioned relative to the axis.
**Reproduction**:
https://codepen.io/CheeryMental/pen/YPWGOLV
### Current Behavior
**Case 1 (Canvas renderer)**
On initial render, RTL text is laid out incorrectly when direction-neutral characters are present (e.g. brackets in this case).
Text direction appears wrong:
Parentheses and surrounding Arabic text are ordered incorrectly.
The visual flow does not match correct RTL rendering.
After interaction with the chart, the RTL layout becomes correct.
**Case 2 (SVG renderer)**
RTL axis labels overlap the axis line.
### Expected Behavior
**case 1**
RTL text should render correctly on the first paint:
Direction-neutral characters (e.g. brackets, numbers, punctuation) are present.
dir="auto" should correctly resolve RTL direction without requiring user interaction.
**case 2**
when SVG renderer is used axis labels should not overlap axes.
Correct RTL behavior should be consistent across:
Canvas renderer
SVG renderer
### Environment
```markdown
- OS: MacOs Tahoe 26.2
- Browser: Chrome
- Framework: Plain javascript + React
```
### Any additional comments?
There’s already a RTL-support discussion in Apache ECharts (#16419), but it primarily focuses on overall chart appearance/layout under RTL.
This issue targets RTL text handling itself (punctuation/neutral characters, label positioning and line breaking) — i.e., how ECharts renders strings in RTL contexts, rather than how the chart is laid out in RTL
Contributor guide
Assessment
This issue has not been assessed yet.