MPAndroidChart icon indicating copy to clipboard operation
MPAndroidChart copied to clipboard

How to hide chart Lables ? How to add axis titles ?

Open Seanmir opened this issue 11 years ago • 12 comments

Hello, I tried to hide chart value labels but I can't figure it out, Here is the current charts that I Have:

donut

screenshot_2015-07-06-13-04-24

Is it possible to hide these labels ? And another issue, is it possible to add axis Titles ? like the one that I have for Bar Chart (I used separate Text view for that Calories title)

And also currently the pie chart have animations and interactions, How can I disable that ?

Thank a lot.

Seanmir avatar Jul 06 '15 11:07 Seanmir

dataSet.setDrawValues(false)

It's all in the documentation. Concerning the axis-title: I have no idea where that comes from, this library does not even support axis-titles.

PhilJay avatar Jul 12 '15 11:07 PhilJay

Hi Philipp, dataSet.setDrawValues(false) on a pieChartDataSet just makes it so that it hides the values. What if I need it to show the values but hide what's in xValues ? (currently shows "option A 30" & "option B 70", need only "30" and "70" also, would like to make the font bigger Thank you

knseir avatar Jul 29 '15 04:07 knseir

I think to hide description values is to add blank string like this. ArrayList xVals = new ArrayList(); for (int i = 0; i < entryPercorso.size() + 1; i++) xVals.add("");

    PieData dataPercorso = new PieData(xVals, dataset);

hotzambo avatar Oct 24 '15 08:10 hotzambo

This will hide Legends also.. Any other way to hide only xvalues alone?

ashokcs avatar Jan 07 '16 05:01 ashokcs

eg. mChart.getXAxis().setDrawLabels(false);

Jasper009-So avatar Jan 07 '16 05:01 Jasper009-So

@coolscott It doesn't work. there is no method called getXAxis() is available.

ashokcs avatar Jan 07 '16 07:01 ashokcs

sorry. yes~ it's PieData. try mPieChart.isDrawSliceTextEnabled() instead.

Jasper009-So avatar Jan 07 '16 07:01 Jasper009-So

You meant mPieChart.setDrawSliceTextEnabled(false) right? Yes, it works. Your swift help has made my day. Thanks a lot @coolscott

ashokcs avatar Jan 07 '16 10:01 ashokcs

bingo. it's my pleasure.

Jasper009-So avatar Jan 07 '16 16:01 Jasper009-So

I know this is an old thread, but I can't locate mPieChart.setDrawSliceTextEnabled(false) method anymore. It seems to be have been removed. Is there an alternate way to hide just the labels on the chart but not the legend?

anuragphadke19 avatar Oct 25 '16 16:10 anuragphadke19

Found the answer almost immediately looking at the code. Just for completion sake, the method to use now is : mPieChart.setDrawEntryLabels(false)

anuragphadke19 avatar Oct 25 '16 16:10 anuragphadke19

@coolscott isDrawSliceTextEnabled method is not resolved with latest version.

jackengine avatar Jul 18 '17 05:07 jackengine