Hello,
I'm using a VerticalBarChart and the x axis is a HorizontalCategoryAxis.
The graph displays with a 1 inch space before the first category is plotted, and also after the last category.
e.g.
|
|
| x x
| x
| x x x x
|__________________
A B C D E F G
How can I remove the space left befor the first category?
I've got the x-axis using getHorizontalAxis() on the plot, but there is no method on the HorizontalCategoryAxis class that is related to this.
Help appreciated.
Regards,
Mike
Space at start and end of X axis
Re: Space at start and end of X axis
Spaces were stripped in diagram above, but basically the category A would start an inch further right..
Re: Space at start and end of X axis
Hi Mike,
The CategoryPlot class has the following methods for controlling gaps in bar charts:
public void setIntroGapPercent(double);
public void setTrailGapPercent(double);
public void setSeriesGapPercent(double);
public void setCategoryGapPercent(double);
The double values are expressed as a percentage of the available drawing space for the plot (for example 0.05 is five percent).
So you'll probably want to do this:
CategoryPlot plot = myChart.getCategoryPlot();
plot.setIntroGapPercent(0.0);
plot.setTrailGapPercent(0.0);
Regards,
DG.
The CategoryPlot class has the following methods for controlling gaps in bar charts:
public void setIntroGapPercent(double);
public void setTrailGapPercent(double);
public void setSeriesGapPercent(double);
public void setCategoryGapPercent(double);
The double values are expressed as a percentage of the available drawing space for the plot (for example 0.05 is five percent).
So you'll probably want to do this:
CategoryPlot plot = myChart.getCategoryPlot();
plot.setIntroGapPercent(0.0);
plot.setTrailGapPercent(0.0);
Regards,
DG.
Re: Space at start and end of X axis
Hi David,
I had: Plot plot = (Plot)chart.getPlot();
But I changed it to:
CategoryPlot plot = myChart.getCategoryPlot();
plot.setIntroGapPercent(0.0);
plot.setTrailGapPercent(0.0);
However I get the following runtime error:
java.lang.VerifyError: (class: myweb/graphs/stats/Charting, method: drawGraph signature: (Ljava/util/vector;Ljava/lang/String;Ljava/lang/String;)V) Incompatible object arguement for function call
Any ideas..
Regards, Mike
I had: Plot plot = (Plot)chart.getPlot();
But I changed it to:
CategoryPlot plot = myChart.getCategoryPlot();
plot.setIntroGapPercent(0.0);
plot.setTrailGapPercent(0.0);
However I get the following runtime error:
java.lang.VerifyError: (class: myweb/graphs/stats/Charting, method: drawGraph signature: (Ljava/util/vector;Ljava/lang/String;Ljava/lang/String;)V) Incompatible object arguement for function call
Any ideas..
Regards, Mike