Whether the axis carrying the categories is drawn from its far end.
<XAxis reversed /> is how Recharts states it, and it lives in the chart
subtree this component renders but never used to read -- so a chart drawn
right to left was announced left to right, with nothing to consult (#1017).
Which axis carries the categories follows the chart's orientation, exactly
as indexAxis decides it for Chart.js (#1016): x normally, y once the bars
are turned on their side. Reversing the value axis moves no category.
A chart may declare several category axes, and Recharts draws each series
on the one its xAxisId (on its side, its yAxisId) names. So what is
asked is whether a <Bar>, <Line> or <Area> is drawn on a reversed
one, and a reversed axis carrying no series turns nothing round. Asking
whether any category axis was reversed read bars drawn left to right on a
plain axis backwards whenever a reversed one was declared beside them. A
series naming no axis the chart declares is drawn on the hidden, plain one
Recharts supplies, so it turns nothing round either.
Series drawn on a reversed axis and on a plain one share this one answer,
which cannot be right for both; they are read as reversed, as they were
before the series were read. A walk that finds no series at all -- drawn
by a component of the chart's own, which it cannot see into -- answers
whether any category axis is reversed, as it did then too.
The walk is depth-first because an axis is commonly nested -- inside a
<ResponsiveContainer>, or behind a fragment. Anything it cannot find or
cannot read answers false, so a chart whose axes are built in a way this
does not recognise keeps the reading it has today rather than being turned
round on a guess. A ridgeline, whose <Area>s share one <YAxis>, reads
its own (ridgelineAxisReversedFor).
Parameters
children: ReactNode
The chart subtree this component was given
horizontal: boolean
Whether the bars are drawn on their side
Returns boolean
True when the category axis the series are drawn on is reversed
Whether the axis carrying the categories is drawn from its far end.
<XAxis reversed />is how Recharts states it, and it lives in the chart subtree this component renders but never used to read -- so a chart drawn right to left was announced left to right, with nothing to consult (#1017).Which axis carries the categories follows the chart's orientation, exactly as
indexAxisdecides it for Chart.js (#1016): x normally, y once the bars are turned on their side. Reversing the value axis moves no category.A chart may declare several category axes, and Recharts draws each series on the one its
xAxisId(on its side, itsyAxisId) names. So what is asked is whether a<Bar>,<Line>or<Area>is drawn on a reversed one, and a reversed axis carrying no series turns nothing round. Asking whether any category axis was reversed read bars drawn left to right on a plain axis backwards whenever a reversed one was declared beside them. A series naming no axis the chart declares is drawn on the hidden, plain one Recharts supplies, so it turns nothing round either.Series drawn on a reversed axis and on a plain one share this one answer, which cannot be right for both; they are read as reversed, as they were before the series were read. A walk that finds no series at all -- drawn by a component of the chart's own, which it cannot see into -- answers whether any category axis is reversed, as it did then too.
The walk is depth-first because an axis is commonly nested -- inside a
<ResponsiveContainer>, or behind a fragment. Anything it cannot find or cannot read answersfalse, so a chart whose axes are built in a way this does not recognise keeps the reading it has today rather than being turned round on a guess. A ridgeline, whose<Area>s share one<YAxis>, reads its own (ridgelineAxisReversedFor).