Hi,
When I create a TimeSeriesCollection and add Week objects with appropriate values and week numbers I get the expected results with the calibrated values down the Y axis and dates down the X axis.
But, when I create Week objects with zero values, and appropriate week numbers I get a funny looking scale for the Y axis.
It has 0.00000000 as the middle value on the center line. I should be just 0.0 or similar.
I want to be able to show a graph that is empty and I would have thought the graph would look normal, but it does not.
Bug or not ? Am I doing it wrong ?
Grant
TimeSeriesCollection zero dataset
Re: TimeSeriesCollection zero dataset
Hi Grant,
This happens because JFreeChart is trying to automatically calculate the axis range based on the data range. In this case the data range is zero, which JFreeChart cannot use for the axis range, so it instead uses the value returned by getAutoRangeMinimumSize() (defined in the ValueAxis class). The default value is:
/** The default minimum auto range. */
public static final Number DEFAULT_AUTO_RANGE_MINIMUM_SIZE = new Double(0.0000001);
You can change the setting using the setAutoRangeMinimumSize(...) method, for example:
ValueAxis rangeAxis = plot.getRangeAxis();
rangeAxis.setAutoRangeMinimumSize(new Double(1.0));
Unfortunately, there are a couple of bugs that prevent this from working completely - they are squashed in CVS now.
Regards,
Dave Gilbert
This happens because JFreeChart is trying to automatically calculate the axis range based on the data range. In this case the data range is zero, which JFreeChart cannot use for the axis range, so it instead uses the value returned by getAutoRangeMinimumSize() (defined in the ValueAxis class). The default value is:
/** The default minimum auto range. */
public static final Number DEFAULT_AUTO_RANGE_MINIMUM_SIZE = new Double(0.0000001);
You can change the setting using the setAutoRangeMinimumSize(...) method, for example:
ValueAxis rangeAxis = plot.getRangeAxis();
rangeAxis.setAutoRangeMinimumSize(new Double(1.0));
Unfortunately, there are a couple of bugs that prevent this from working completely - they are squashed in CVS now.
Regards,
Dave Gilbert