Hi,
I'm trying to build a bit a special piecharts, where all the bits are more or less exploded, but stil connected to the center. I got that 'sort of working', it is not perfect, but most annoying is that the oiechart size does not take inot account the fact that the secgments become larger when using strokes, and then overflow the border of the graph.
the core of my code is:
for (int j=0;j<NumberOfVariables;j++)
{
String Colours[] = VariabelArray[j][2].split(",");
R= Integer.valueOf(Colours[0]);
G= Integer.valueOf(Colours[1]);
B= Integer.valueOf(Colours[2]);
plot.setSectionPaint(VariabelArray[j][0], new Color (R,G,B));
plot.setExplodePercent(VariabelArray[j][0], ExplodeValues[(j%3)]);
plot.setSectionOutlinePaint(VariabelArray[j][0],new Color (R,G,B));
plot.setSectionOutlineStroke(VariabelArray[j][0],new BasicStroke(StrokeValue[(j%3)]));
}
And the two arrays which control the look of the graph contain::
ExplodeValues[0]=0.0;
ExplodeValues[1]=0.08;
ExplodeValues[2]=0.16;
StrokeValue[0]=4f;
StrokeValue[1]=10f;
StrokeValue[2]=30f;
as said, it 'sort of works', I'm not entirely happy about the amount of fiddling it takes to make the segments touch but not overlap, but the most disturbing is that the graph goes over the limits of the picture.
Piechart Size does not take into account strokesize
-
- Posts: 1
- Joined: Thu Jul 13, 2017 8:13 am
- antibot: No, of course not.
-
- Posts: 1634
- Joined: Sat Feb 17, 2007 1:51 pm
Re: Piechart Size does not take into account strokesize
JFreeChart does not correct/adjust the sizes of any shape (including the slixes of a pie chart) by taking the outline stroke into account.
You will have to implement that correction of your own.
You will have to implement that correction of your own.