Efka
Efka

Reputation: 134

MPAndroidChart starting bars in other place than 0

Id like to achive someting like this where more negative values appear below less negative. Is it possible for bars to start in other place than 0. chart.getAxisLeft().setInverted(true); does not do what i want.

How it should look

Upvotes: 1

Views: 148

Answers (1)

R. Zagórski
R. Zagórski

Reputation: 20278

You can control the span of Y axis by two functions from AxisBase:

public void setAxisMinimum(float min)

public void setAxisMaximum(float max)

Just iterate through values, choose minimum and maximum values and set Y axis min and max values:

In the case of provided example:

mChart.getAxisLeft().setAxisMinimum(-112f);
mChart.getAxisLeft().setAxisMaximum(-12f);

Upvotes: 1

Related Questions