Mpandroidchart: How can i set fixed values on y-axis ????

Created on 6 Nov 2014  ·  10Comments  ·  Source: PhilJay/MPAndroidChart

Hi all!
I would like to set fixed values (labels) on y-axis. For example, from 0 to 30 and display always this range. Can i do that? I'm looking into library code, but i have no idea how to do this.

Thanks in advance!

Most helpful comment

I used this:

YAxis y = mChart.getAxisLeft();
y.setLabelCount(5);
y.setAxisMaxValue(100);
y.setAxisMinValue(20);

So, will make this:

20 - 40 - 60 - 80 - 100

All 10 comments

Call chart.setYRange(0, 30, true);

Thanks PhilJay!

I can‘t find this method in the latest release?1.7.4.! How could it happen?

Im not sure what you mean. The method is still there, you can see it in the latest commit.

public void setYRange(float minY, float maxY, boolean invalidate)

I do not see this method public void setYRange(float minY, float maxY, boolean invalidate) in chart class

I am using library version mpandroidchartlibrary-2-1-4

I don't see it either

I too cannot see this function on an object of type LineChart.

For linechart you set it to axises, like this (left and/or right):

lineChart.getAxisLeft().setAxisMaxValue(100f);
lineChart.getAxisLeft().setAxisMinValue(0f);

I used this:

YAxis y = mChart.getAxisLeft();
y.setLabelCount(5);
y.setAxisMaxValue(100);
y.setAxisMinValue(20);

So, will make this:

20 - 40 - 60 - 80 - 100

i am currently using seek bars to change the values on the radar chart but the axis keeps resizing, how do i make it that it just has a standard range of 0 - 100 in intervals of 10.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vishvendu picture vishvendu  ·  3Comments

SutharRohit picture SutharRohit  ·  3Comments

chathudan picture chathudan  ·  3Comments

thanhcly920 picture thanhcly920  ·  3Comments

galex picture galex  ·  3Comments