A discussion forum for JFreeChart (a 2D chart library for the Java platform).
-
hyeungsf
- Posts: 6
- Joined: Sat May 31, 2008 3:19 am
Post
by hyeungsf » Sat May 31, 2008 3:33 am
Hi there!
I think this question has been asked couple times before in the forum. But I cannot find a good answer.
Basically I have a stacked bar chart. The chart looks ok when there isn't too many bars. However the chart will have a lot of white space on the left and right when there are >20 bars. How can I get rid of the white space? I guess the problem can be solve either if the chart/plot is aligned to the left or the render automatically remove the un-used space at the beginning and end of the domain axis. Can this be done?
Thanks!

-
hyeungsf
- Posts: 6
- Joined: Sat May 31, 2008 3:19 am
Post
by hyeungsf » Mon Jun 02, 2008 4:31 pm
After looking at the demo source, I found the following:
Since I just want to get rid of the whitespace at the both ends of the domain axis, this will do the trick.
CategoryAxis axis = chart.getCategoryPlot().getDomainAxis();
axis.setLowerMargin(0.01);
axis.setUpperMargin(0.01);
-
siowling
- Posts: 12
- Joined: Thu Sep 02, 2004 10:48 am
Post
by siowling » Thu Jul 10, 2008 3:49 am
Thanks! That really helped.
