Mapping% ofDistribution to PieChart with aChartEngine

I am trying to create Piechart in my android application. this link using achartengine. But I still have a problem. I want to show the% distribution in the pie chart itself

Thanks in advance.

+4
source share
2 answers

I was looking for the same thing too. But see Dan's answer here . I believe he is the guy behind AChartEngine, and he says that the names of the legends and labels cannot be different.

Update:

Despite the fact that I did this, I made the legend size equal to 0. Then, in the shortcut, I set the label and the calculated percentage together. So, in your case, the labels will look like this:

Mg +: 23%

Na +: 45% ... so on.

Update: 2

This problem is for the present in version 1.0.0 and was resolved in the latest version 1.1.0-rc2. You can download it from here . Now that @Dan says here , we can have different Legend and Label values. We can also use:

renderer.setDisplayValues(true); 

to display the percentage distribution in the pie chart itself.

+3
source

To get the information in the form of%, you can use the following:

 renderer.setChartValuesFormat(NumberFormat.getPercentInstance()); 
-1
source

Source: https://habr.com/ru/post/1469428/


All Articles