How to remove description from chart in MPAndroidChart?

梦想的初衷 提交于 2019-11-29 00:59:28

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.

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);

you can remove it by simply passing null into it.

pieChart.setDescription(null);

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!