Pie chart label improvements

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Fredrik Herbertsson

Pie chart label improvements

Post by Fredrik Herbertsson » Tue Jan 28, 2003 10:43 pm

Hi,

I've currently been struggeling to change the position of category labels in a pie chart and have some suggestions for improvements.

The first thing I ran into was that i would like to make the position dependant on the section (zero-based index). It would be a neat thing to have the section passed as an argument to the
PiePlot.calculateLabelLocation(..) method. I have sub-classed the PiePlot and altered the drawLabel(..) method to solve this.

Another thing I heve seen is that the drawLabels(...) method only is called if the value of the category is greater than zero. Since I'm placing all my labels on the left side of my pies in a multi series pie plot (using CategoryDataset), I really would like to be able to draw the label even though the value for a particular category is zero. For other series this category has values greater than zero. Now I get a 'hole' for labels belonging to empty categories. To fix this I would have to override the entiere drawPie() method. Seems a little tedious :-)

Further, there seem to be some problem with updating the plot when the dataset changes. Now, I solve this by re-setting the dataset with setDataset(...).

Otherwise I would like to thank you all for an excellent product. I really think it is great to use and the code is of very high quality!

Regards
/Fredrik

David Gilbert

Re: Pie chart label improvements

Post by David Gilbert » Wed Jan 29, 2003 12:20 am

Hi Fredrik,

Thanks for the suggestions. The label code in the pie charts is in need of some work, as you have noted. I won't get a chance to work on that part of the code for a little while, but if you want to have a go at rearranging it and submit some changes, I will appreciate it (as will others I am sure).

Regards,

Dave Gilbert

Locked