In my application I want to display some data on a pie chart. I'm using the MPAndroidChart library and following the documentation I managed to program a nice looking chart with all my data correctly displayed.
Now, I'd like to improve my chart, but I'm having some trouble. My data refers to a single day, but there are two categories: incomes and revenues. Until now I've handled them as a single PieDataSet (they have labels, so it is quite easy to distinguish among them). Now I'd like to differentiate among incomes and revenues, to show them with different colors in the same pie chart.
I tried following this link (the line chart part) adapting it to pie charts, but Android Studio tells me that I can't use a List<IPieDataSet> as parameter for a constructor of a PieData object. Here is the code:
public static void drawPie( List<PieEntry> entriesU, List<PieEntry>entriesE, PieChart chart){
PieDataSet set = new PieDataSet(entriesU,"uscite");
PieDataSet set1 = new PieDataSet(entriesE,"entrate");
List<IPieDataSet> dataSets = new ArrayList<>();
dataSets.add(set);
dataSets.add(set1);
set.setSliceSpace(5);
set1.setSliceSpace(5);
PieData data = new PieData(dataSets);
chart.setData(data);
}
I've searched a lot but I still haven't found an answer to this problem.
Question:
It is possible to display multiple data sets on the same pie chart or not? And if it is possible, how can I do it?