Pie chart: how to specify the radius of the pie?

A free public discussion forum for the JFreeChart class library.

Pie chart: how to specify the radius of the pie?

Postby spennec » Thu Jan 14, 2010 8:47 am

Hello (again),

I'm drawing two pie charts, and insert them into the same PDF page. The exported charts have the same sizes. On both charts, the legend is included, and added on the right of the chart. In fact, these are two instances of the same class but with different values.

The problem is that the pies do not have the same radius, and it doesn't look good on the page...

Is there a way to force a radius when drawing a pie chart? I haven't found any references to such configuration in the book...

Thanks for any help :)
spennec
 
Posts: 6
Joined: Mon Jan 11, 2010 11:55 am

Re: Pie chart: how to specify the radius of the pie?

Postby barefoot » Thu Feb 25, 2010 1:06 am

I happened upon this post whilst generating a PDF myself over the past couple of weeks--probably you've already solved it somehow, but posting this for posterity anyways. I never did find a great way to explicitly specify the radius of the pie itself (which seems odd), however there is a "trick" to force the radius to be smaller at least: set the label gap.

The specific method is PiePlot.setLabelGap(). The value is expressed as a percentage of the chart width, what it does is set the amount of padding between the pie itself and the section labels that are decorated around it. More padding == less pie, more or less. So, by setting the width/height of the entire chart, e.g. when rendering as a PNG, and then setting the label gap, you should be able to force the radius of your pie to whatever you like. It worked fine for me at least.
barefoot
 
Posts: 1
Joined: Thu Feb 25, 2010 12:55 am

Re: Pie chart: how to specify the radius of the pie?

Postby spennec » Thu Feb 25, 2010 8:42 am

Hello barefoot,

Thanks for your reply! Actually, I haven't found any resolution for this problem, so your suggestion might help me :)

I totally agree with you on the fact that it is odd that one cannot force the radius... I'm going to add a feature request about it, and we'll see what happens...
spennec
 
Posts: 6
Joined: Mon Jan 11, 2010 11:55 am


Return to JFreeChart - General

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Yahoo [Bot] and 11 guests