Hi folks,
I am trying to set the width of my BoxAndWhisker items - they are too fat.
I tried this, but it has no effect:
BoxAndWhiskerRenderer bRenderer = (BoxAndWhiskerRenderer) plot.getRenderer();
bRenderer.setSeriesFillPaint(0, Color.green);
bRenderer.setItemMargin(0.5);
I'm using jfreechart-1.0.9. The color doesn't change either.
The chart I'm making is an overlaid chart, so I add a line chart on top of it, so people can see where they fall in the norms, but such fat boxes look bad...
How to set width of BoxAndWhisker item?
I figured out the problem. SetMargin is actually using a percentage of the available space for bars/boxes. And it's a 0 to 1 percentage, so .5 was way too big. The greater the margin, the smaller the bars/boxes. Also, you don't want to set the margin on the item, that's actually the wrong one. You want to set the margin on the axis.
Hope that helps someone....
Code: Select all
CategoryAxis domainAxis = plot.getDomainAxis();
domainAxis.setLowerMargin(0.15);
domainAxis.setUpperMargin(0.15);
domainAxis.setCategoryMargin(0.25);
-
- Posts: 1
- Joined: Sun Apr 06, 2008 1:07 am
Trouble scaling a single BoxAndWhisker plot
Hi,
Not sure this is 100% related, but I'm trying to render a single BoxAndWhisker plot (single data set - 1 series and 1 category). The width of the Box plot is huge - it takes up the width of the whole window. The median dot is also huge. Is there a way to adjust this? Also, in your example code, what type of object is "plot"?
Thanks very much!
Not sure this is 100% related, but I'm trying to render a single BoxAndWhisker plot (single data set - 1 series and 1 category). The width of the Box plot is huge - it takes up the width of the whole window. The median dot is also huge. Is there a way to adjust this? Also, in your example code, what type of object is "plot"?
Thanks very much!