How to hide x-axis values in Barchart of mpandroidChart

6.6k views Asked by At

I am using barchart from mpandroidchart library.

I want to hide the x-axis values, but I am not able to hide the values. Please help me through it. I used the following code but it doesn't work.

barChart.getXAxis().removeAllLimitLines();
2

There are 2 answers

1
Philipp Jahoda On

You want to hide only the labels of the axis, call xAxis.setDrawLabels(false)

If you want to hide the whole axis, call xAxis.setEnabled(false)

It's all in the documentation.

4
rafaelasguerra On

Workaround:

Define transparent color:

 <color name="transparent">#00000000</color>

And then, set the axis line color:

XAxis xAxis = barChart.getXAxis();
xAxis.setAxisLineColor(getResources().getColor(R.color.transparent))