简体   繁体   中英

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期待

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM