Reputation: 105
I have a Recharts Line graph, and the X-Axis has too many data points, and is looking very congested. Following is the current graph:
Is there a way that I can rotate this text to lets say 270° so that all the labels would be visible?
Upvotes: 2
Views: 362
Reputation: 284
Here is an example in codesandbox - link
<XAxis
dataKey="name"
tick={{ textAnchor: "end" }}
angle={-45}
/>
the tick
object helps set attributes specific to the tick text that is rendered so we need to change the textAnchor there so the word ends at the tick line. And then of course set angle
to a negative number so the labels are rotated in a way they can be read
Upvotes: 0