0

I am a bit new to JFreeChart and I had a requirement of showing both simple and extended labels on 3d pie chart using JFreeChart java library & JasperSoft i.e percentage labels on top of the sections of 3d pie chart as simple labels and the key on adjacent sections as an extended label.

I am able to achieve either one of the labels at a time by using the below code snippet.

setSimpleLabels(true) - lable on top of the section

setSimpleLabels(false) - lable on adjacent of the section

How to achieve both the label's designs in one single 3d pie chart as shown below in the image? enter image description here

Thanks in advance

Alex K
  • 22,315
  • 19
  • 108
  • 236
ITIB
  • 353
  • 6
  • 16
  • As these are mutually exclusive, why not both key _&_ percent on one label, for [example](https://stackoverflow.com/a/36830243/230513); more [here](https://stackoverflow.com/a/3551238/230513)? – trashgod Aug 21 '21 at 22:12
  • Thanks for your help. I had done that key and percentage in a label. But, I have a requirement of displaying the key as extended label and percentage as simple label. So, looking for a way to do that. – ITIB Aug 22 '21 at 03:05
  • You could try a custom implementation of `drawPie()`. – trashgod Aug 22 '21 at 12:42
  • It would be very helpful if you could share a code snippet for the custom label in drawPie(). – ITIB Aug 27 '21 at 09:25
  • I cited label samples [above](https://stackoverflow.com/questions/68876506/how-to-show-both-simple-and-extended-label-both-in-3d-pie-chart-using-jfreechart#comment121725975_68876506); although untested, I was looking at changing [this](https://github.com/jfree/jfreechart/blob/09e374f617c3a5c2e68d260f17a03f1e3f584121/src/main/java/org/jfree/chart/plot/PiePlot.java#L2281) to draw both; I'm guessing you'd have to work out a way to render two different label, too. – trashgod Aug 27 '21 at 23:03

0 Answers0