Pie chart Linking lines: straight instead of rounded

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
spennec
Posts: 6
Joined: Mon Jan 11, 2010 11:55 am
antibot: No, of course not.

Pie chart Linking lines: straight instead of rounded

Post by spennec » Thu Jan 14, 2010 8:24 am

Hello,

I've created a PieChart, with labels. Those labels are linked to the corresponding sections with linking lines.

Those lines are configured with the default values: I've not overriden or set anything to modify their look, so as you might expect they have "rounded elbows" between the label and the section.

What I would like to obtain is the same linking lines, without the rounded elbows, but with "corner" elbows. As if the line was in fact composed of two lines connecting each other at a "corner point".

In the book, the section 34.30.13 explains how to configure further those linking lines, but I haven't been able to get the result I described above. And playing around with Stroke objects doesn't seem to do the trick either.

Does anybody know how to change the type of elbow of those lines?

Thanks! :)

raulosan
Posts: 5
Joined: Mon Jan 18, 2010 5:02 pm
antibot: No, of course not.

Re: Pie chart Linking lines: straight instead of rounded

Post by raulosan » Mon Jan 25, 2010 4:20 pm

Hello,
I have the same problem.

I've noticed that in old tutorials (http://www.screaming-penguin.com/node/4005, http://www.java2s.com/Code/Java/Chart/Pie-Chart.htm)the label lines are straight, and in a quite new tutorial from Lars Vogel (http://www.vogella.de/articles/JFreeChart/article.html) that uses jcommon-1.0.16.jar and jfreechart-1.0.13.jar, those lines are curved. Maybe the default mode in the newest version has changed but there's a way to change that property.

I've tried to download jfreechart-1.0.12.jar but I had problems with the downloading from sourceforge, so I couldn't prove it.

In chase I find any solution I post it hear.

Regards.

raulosan
Posts: 5
Joined: Mon Jan 18, 2010 5:02 pm
antibot: No, of course not.

Re: Pie chart Linking lines: straight instead of rounded

Post by raulosan » Tue Jan 26, 2010 11:15 am

Hello,
this has worked to me:

PiePlot plot = (PiePlot) chart.getPlot();
plot.setLabelLinkStyle(PieLabelLinkStyle.STANDARD);

spennec
Posts: 6
Joined: Mon Jan 11, 2010 11:55 am
antibot: No, of course not.

Re: Pie chart Linking lines: straight instead of rounded

Post by spennec » Tue Jan 26, 2010 12:00 pm

This is exactly what I was looking for, although the Standard type of linking lines can be a bit messy when one of the values takes a big part of the pie... Maybe the Quad Curve style will better fit my needs.

Anyway, thanks for the hint! :D

Locked