got the following code:
Legend legend = mChart.getLegend();
legend.setLabels(new String[]{\"aaaaa\", \"bbbbb\", \"ccccc\"});
This s
1)Add dependency to build.gradle
app level
compile 'com.github.PhilJay:MPAndroidChart:v2.1.0'
2)make function chartData
private void chartData() {
ArrayList entries = new ArrayList<>();
entries.add(new Entry(50, 0));
entries.add(new Entry(60, 1));
final int[] piecolors = new int[]{
Color.rgb(183, 28, 28),
Color.rgb(27, 94, 32)};
PieDataSet dataset = new PieDataSet(entries, "");
ArrayList labels = new ArrayList();
labels.add("Borrowing");
labels.add("Pending");
PieData data = new PieData(labels, dataset);
dataset.setColors(ColorTemplate.createColors(piecolors)); //
data.setValueTextColor(Color.WHITE);
pieChart.setDescription("Description");
pieChart.setData(data);
}
3)Call chartData()
in onCreate()