3

Hi I am using A chart Engine to display pie chart in android.In my code I want to show values on labels and area corresponding to that vale on legend.But I am unable to get that one.Please can any one helps to me.Thanks in advance.

I want like below

hcp
  • 279
  • 1
  • 5
  • 13
  • Can you add a screenshot showing what exactly you need? – Dan D. Dec 06 '12 at 03:30
  • I am new user I have no rides to upload images.Here I am displaying Humans age on chart.I want to show age as labels and their names as Legends. – hcp Dec 06 '12 at 06:38

2 Answers2

3

Displaying the pie labels with separate values from the legend labels is not possible in AChartEngine.

However, you can display the pie slice value (age in your case) in the middle of each slice, using:

renderer.setDisplayChartValues(true);

There was a bug in the code that was preventing displaying the chart values when the labels were not displaying. I have just fixed this issue in SVN. You can checkout the code according to this page and run an ant dist in order to build an up to date achartengine.jar file including this fix.

Dan D.
  • 32,246
  • 5
  • 63
  • 79
  • 1
    Please try the 1.1.0-rc2 version and let me know if it fixes the issue. You can download it here: http://www.achartengine.org/download/ – Dan D. Jan 10 '13 at 07:37
  • @Dan In this version can we have different Label and Legend values? – Shobhit Puri Mar 17 '13 at 08:53
  • @Dan : I need to show percentage in pie slices, I have downloaded your nightly build from here http://repository-achartengine.forge.cloudbees.com/snapshot/org/achartengine/achartengine/1.2.0/ but I cannot get the method `mRenderer.setChartValuesFormat(NumberFormat.getPercentInstance());` Can you please provide a reference ? – Girish Nair Oct 31 '14 at 11:30
2

I was also having the same problem but now its solved. Thanks dan...

You can use

renderer.setDisplayValues(true);

This displays the %of distribution in the pie chart itself.