I am using MPAndroidChart library and I want to remove the values in in the top right corner of the PieChart
, how can I do this ?
Asked
Active
Viewed 7,229 times
12

Philipp Jahoda
- 50,880
- 24
- 180
- 187

Russell Ghana
- 2,963
- 3
- 20
- 31
4 Answers
29
The values you are talking about belong to the Legend.
To disable them (prevent them from being displayed), call
Legend l = chart.getLegend();
l.setEnabled(false);

Philipp Jahoda
- 50,880
- 24
- 180
- 187
-
1On the new release you should use `chart.setDrawLegend(false);` – Filipe Ramos May 15 '15 at 11:52
-
1This was the old release :-) – Philipp Jahoda May 15 '15 at 11:55
-
1how to hide specific legend means legend for dataset3? – Nouman Ch Oct 24 '18 at 07:10
1
you can set like this
linechart.setData();
...
linechert.getLegend().setEnable(false);
gone Legend should be at the back of setData()

dursss
- 11
- 1
0
try pieChart.setDrawSliceText(false)

Muhannad Fakhouri
- 1,468
- 11
- 14
-
no , this would remove the x-Values from inside of pie, but we have a list of x-Values in the top right corner of the pie Chart , and under this list we have the pie chart Label , i want to remove this List and the Label – Russell Ghana Apr 03 '15 at 09:18
0
Add this code into xml file:
<com.github.mikephil.charting.charts.PieChart
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/pie_chart">
</com.github.mikephil.charting.charts.PieChart>
Write this into .java file:
pieChart = findViewById(R.id.pie_chart);
Legend l = pieChart.getLegend();
l.setEnabled(false);

Matt Ke
- 3,599
- 12
- 30
- 49

AJAY KACHHIYAPATEL
- 139
- 2
- 10