Skip to content

No way to place the Y axis on the right, which breaks RTL locales #87

Description

@3li7alaki

Problem

In an RTL locale (Arabic, Hebrew, Farsi) the value axis belongs on the right, the reading-side edge. @tanstack/charts@0.11.0 appears to have no option for it: the axis always renders on the left.

Searching the published types, there is no side, orientation, or position on ChartAxisOptions, and the only placement type in the package is ChartLegendPlacement = 'top' | 'bottom'.

The X axis is fine: x: { reverse: true } flips the category order correctly, so time already reads right-to-left. It is only the Y axis placement that has no lever.

Why a CSS workaround is not one

transform: scaleX(-1) on the container mirrors the marks and the tick text, and breaks pointer hit-testing and gradient direction. direction: rtl on the host does not move the axis, since the placement is computed in the layout, not laid out by the browser.

What we did

We migrated a production app off recharts to @tanstack/charts and shipped the Arabic locale with the Y axis on the wrong side, as a deliberate, documented regression, because everything else about the migration was an improvement. recharts covers this with <YAxis orientation="right" />.

Ask

An axis-side option, e.g.

y: { axis: { side: 'end' } }   // or 'right' | 'left', or an rtl flag on the chart

'start' | 'end' would be the nicer spelling: it composes with x.reverse and means the chart can be made RTL-correct with one flag rather than per-axis literals.

Happy to send a PR if you can point at where axis placement is resolved in the layout.

Environment

  • @tanstack/charts 0.11.0
  • React 19, SVG renderer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions