Reputation: 395
I´m read various tutoriais but most of then show the same example. The legend array is put in a constructor of:
new PieData(legendValues, IPieDataSet dataSet)
But PieData doesn't have this constructor.
Does have anyone a sample code for this issue?
Upvotes: 1
Views: 1527
Reputation: 3246
I'm assuming you are using the latest 3.0.0-beta1
version of the library. For that version a lot of (breaking) changes were made to support float
x-values.
Specifically, the PieData
constructor has changed and now only accepts an IPieDataSet
. The labels are now set with the PieEntry
which has a PieEntry(float value, String label)
constructor. Here's a small example illustrating how you set labels in the latest version of the library:
ArrayList<PieEntry> entries = new ArrayList<>();
entries.add(new PieEntry(25, "Android 5.0"));
entries.add(new PieEntry(25, "Android 5.1"));
entries.add(new PieEntry(25, "Android 6.0"));
PieDataSet dataSet = new PieDataSet(entries, "Android versions");
PieData data = new PieData(dataSet);
Upvotes: 2