setDrawSliceText(boolean) is deprecated

Viewed 821

Is there any way to solve setDrawSliceText is deprecated. I did not find any solution regarding this.

How to get pieChart.setDrawSliceText(false);

2 Answers

It is deprecated, however in its javadoc it states:

/**
 * Set this to true to draw the entry labels into the pie slices (Provided by the getLabel() method of the PieEntry class).
 * Deprecated -> use setDrawEntryLabels(...) instead.
 *
 * @param enabled
 */

so use setDrawEntryLabels instead

Here with Example :

    ArrayList<PieEntry> yvalues = new ArrayList<PieEntry>();
    yvalues.add(new PieEntry(8f, "", 0));
    yvalues.add(new PieEntry(15f, "", 1));
    yvalues.add(new PieEntry(12f, "", 2));

    PieDataSet dataSet = new PieDataSet(yvalues, "");
    dataSet.setDrawValues(false);
Related