Issue
I am using JFreeChart, and I want to remove the left and right spaces in my waterfall chart.
Here is what my chart looks like right now with the red squiggles to demonstrate the space I want to remove.

Any idea how to remove these spaces?
Solution
Because ChartFactory.createWaterfallChart() instantiates a CategoryAxis, simply set the relevant margins:
CategoryAxis domainAxis = plot.getDomainAxis();
domainAxis.setLowerMargin(0);
domainAxis.setUpperMargin(0);
Addendum: Note that negative values make the margin smaller, as illustrated here.
domainAxis.setLowerMargin(-0.05);
domainAxis.setUpperMargin(-0.05);
Answered By - trashgod
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.