I am trying to create a Piechart in my android app. this link using achartengine helped. But I still have a problem. I want to display the % of distribution in the pie chart itself
Thanks in advance.
I am trying to create a Piechart in my android app. this link using achartengine helped. But I still have a problem. I want to display the % of distribution in the pie chart itself
Thanks in advance.
I was also looking for the same. But see the answer given by Dan here. I suppose he is the guy behind AChartEngine and he says that the names of legends and Labels cannot be different.
Update:
Although what I did to over come this was, that I made the legend size as 0. Then in the label I set the label and the computed percentage together. So, in your case, the labels would turn out to be:
Mg+ : 23%
Na+ : 45% ...so on.
Update:2
This issue for present in version 1.0.0 and has been solved in the latest version 1.1.0-rc2 version. You can download it from here. Now as @Dan says it here, we can have different Legend and Label values. We can also use:
renderer.setDisplayValues(true);
to displays the percentage distribution in the pie chart itself.
In order to get the details in % form, you can use the following :
renderer.setChartValuesFormat(NumberFormat.getPercentInstance());