Sunny Vaghadia
Sunny Vaghadia

Reputation: 583

Recharts Y-Axis interval issue

I am using Recharts Library for the graph in the ReactJS. There is one strange issue of setting intervals for the Y-Axis. There are few options available "preserveStart" | "preserveEnd" | "preserveStartEnd" | Number. For me, this is not working.

I have attached a couple of screens to showcase what I am expecting and what I get.

Expectation Expectation

Actual Actual

Note: Due to the confidentiality of the project, I am not allowed to put the code here. Please let me know if more information is required.

Upvotes: 5

Views: 14948

Answers (1)

Orlyyn
Orlyyn

Reputation: 2606

In order to see a given number of ticks on the Y-Axis, you need to use the props tickCount - the number of ticks to show (by default, it's 5).

So you're Y-Axis should simply look like this:

<YAxis tickCount={10} />

The interval props allows you to show only a part of the ticks; '0' would show all, '1' would show half (1 every 2 ticks), etc.

Upvotes: 13

Related Questions