Question

I'm trying to create a Timeseries chart in iReport 5.0.0 and want to remove the space between the Y axis and the lines in the graph, how would i do that?

I already have a Customizer class and have tried to thinker whit some of the values in it but to no luck. Any help much appreciated.

Added a datescale to the y axis and it seems like my first date is at 2011-06-30 but my x-axis starts att 2011-05-01 for som reason.

Was it helpful?

Solution

In your chart customizer, cast your plot to an XYPlot (or just call chart.getXYPlot()) and then call setAxisOffset on it. This method sets the gap between the axes and the plot. (javadoc here)

Removing the gap from the y-axis should be as simple as calling:

plot.setAxisOffset(new RectangleInsets(5.0, 0.0, 5.0, 5.0));

Removing all of the gaps can be done with:

plot.setAxisOffset(new RectangleInsets(0.0, 0.0, 0.0, 0.0));

or

plot.setAxisOffset(RectangleInsets.ZERO_INSETS);

Edit: By default, the plot will begin slightly before the first data point. If you want the data to begin immediately at the edge of the plot, call setMinimumDate on your date axis, setting it to the same value as the first point in your dataset.

OTHER TIPS

The axis now works. I did this:

Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR,2011);
cal.set(Calendar.MONTH,05);
cal.set(Calendar.DAY_OF_MONTH,30);

java.util.Date d = cal.getTime();
domainAxis.setMinimumDate(d);

The above answer is resolved. I will also open up a new thread on how to get the first value in a series. But that will be a separate question.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top