Hello, All
I'm a newbie JFreeChart user, and I was wondering if someone could answer the question of changing the thickness of a bar in the bar charts.
When I have only two bars, they are much too thick for a good presentation. I tried changing the IntroGap, CategoryGap, TrailGap settings, but they seem to have no effect.
Any suggestions?
Thanks in advance.
Peter
changing bar "thickness"
RE: changing bar "thickness"
Peter,
You're on the right trail - the SeriesGap, CategoryGap, IntroGap and TrailGap attributes (in the BarPlot class) are the only things that give you control over the width of the bars in a chart.
I'm not entirely happy with the way this works, but at the moment I can't think of a better way to do it and still have the charts look reasonable across a range of different sizes.
Suggestions are welcome!
Regards,
DG.
You're on the right trail - the SeriesGap, CategoryGap, IntroGap and TrailGap attributes (in the BarPlot class) are the only things that give you control over the width of the bars in a chart.
I'm not entirely happy with the way this works, but at the moment I can't think of a better way to do it and still have the charts look reasonable across a range of different sizes.
Suggestions are welcome!
Regards,
DG.
RE: changing bar "thickness"
Greetings, David
Thanks for the fast reply. After a deeper search into the forum, I discovered the proper code. Here it is, for other people who might be curious:
BarPlot myBarPlot = (BarPlot)chart.getPlot();
myBarPlot.setIntroGap(50);
myBarPlot.setTrailGap(50);
myBarPlot.setCategoryGap(50);
I had tried by creating a HorizontalBarPlot object, but my settings had no effect.
Thanks.
Peter
Thanks for the fast reply. After a deeper search into the forum, I discovered the proper code. Here it is, for other people who might be curious:
BarPlot myBarPlot = (BarPlot)chart.getPlot();
myBarPlot.setIntroGap(50);
myBarPlot.setTrailGap(50);
myBarPlot.setCategoryGap(50);
I had tried by creating a HorizontalBarPlot object, but my settings had no effect.
Thanks.
Peter
How-To: Preserving space after removing legend
Hello again,
I was wondering how one might preserve some padding on the right hand side of the chart after you set the legend to null?
With the legend removed, the final tick value is crammed against the right side.
Any ideas on getting back some padding?
Cheers,
Peter
I was wondering how one might preserve some padding on the right hand side of the chart after you set the legend to null?
With the legend removed, the final tick value is crammed against the right side.
Any ideas on getting back some padding?
Cheers,
Peter