12

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 ?

Philipp Jahoda
  • 50,880
  • 24
  • 180
  • 187
Russell Ghana
  • 2,963
  • 3
  • 20
  • 31

4 Answers4

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