How to remove description from chart in MPAndroidChart?

AndroidMpandroidchart

Android Problem Overview


I am using MPAndroidChart.

How can I remove the description from PieChart? I can remove the Legend with chart.setDrawLegend(false), but I couldn't find anything regarding the chart description in the documentation.

Android Solutions


Solution 1 - Android

Do you mean the description which is in the bottom right corner (default) of the Chart?

If so, simply call:

chart.getDescription().setEnabled(false);

Or did you mean the textual description inside the pie-slices?

pieChart.setDrawSliceText(false);

Or did you mean the actual slice values inside the pie-slices?

pieData.setDrawValues(false);

Or are you talking about the Legend (shows all DataSet labels and colors outside of the chart)?

chart.getLegend().setEnabled(false);

This answer is based on release v3.0.0+, for more information check out the documentation.

Solution 2 - Android

In the new version you can do it like this:

Description des = Chart.getDescription();
des.setEnabled(false);

If you want to remove the legend:

Legend leg = Chart.getLegend();
leg.setEnabled(false);

Solution 3 - Android

you can remove it by simply passing null into it.

pieChart.setDescription(null);

Solution 4 - Android

in kotlin use

chart.description.isEnabled = false

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiondbamView Question on Stackoverflow
Solution 1 - AndroidPhilipp JahodaView Answer on Stackoverflow
Solution 2 - AndroidmilihooshView Answer on Stackoverflow
Solution 3 - AndroidRahul SinghView Answer on Stackoverflow
Solution 4 - Androidselvaraj ashokView Answer on Stackoverflow