如何在MPAndroidChart中设置Y轴的增量值

时间:2022-09-26 18:54:01

I need to change increment value for Y axis.

我需要改变Y轴的增量值。

I'm using this code to set min and max:

我正在使用此代码设置min和max:

YAxis rightYAxis = chart.getAxisRight();
rightYAxis.setAxisMaxValue(180);
rightYAxis.setAxisMinValue(0);

It gives me this view of the right Y axis:

它给出了右Y轴的这个视图:

如何在MPAndroidChart中设置Y轴的增量值

Y axis shows [0, 30, 60, ..., 180] so increment here is 30. But I need to set increment equal 10. So I want to see [0, 10, 20, ..., 180].

Y轴显示[0,30,60,...,180]因此这里的增量为30.但我需要设置增量等于10.所以我想看[0,10,20,...,180]。

I thought that mChart.setVisibleYRange(10, YAxis.AxisDependency.RIGHT); will help me, but it didn't. The same for rightYAxis.mAxisRange = 10;.

我以为mChart.setVisibleYRange(10,YAxis.AxisDependency.RIGHT);会帮助我,但事实并非如此。对于rightYAxis.mAxisRange = 10;同样如此。

Is it possible to set it up? It would be very useful.

是否可以设置它?这将非常有用。

1 个解决方案

#1


Try

yAxis.setLabelCount(19)

This should give you labels from 0 to 180 in steps of 10, assuming you set min to 0 and max to 180.

假设您将min设置为0并且max设置为180,则应该以10为步长给出0到180之间的标签。

#1


Try

yAxis.setLabelCount(19)

This should give you labels from 0 to 180 in steps of 10, assuming you set min to 0 and max to 180.

假设您将min设置为0并且max设置为180,则应该以10为步长给出0到180之间的标签。