The org.jfree.chart.axis.DateAxis class contains two methods, setMinimumDate and setMaximumDate. These methods set the end-points of the plot's date axis. However, a problem arises, usually with an empty plot, when the new min is *later* than the existing max or when the new max is earlier than the existing min (a diagram would help here...)
In either case, it is possible to try to set the axis range with max < min. This throws an IllegalArgumentException in the range constructor:
Caused by: java.lang.IllegalArgumentException: Range(double, double): require lower (6.11284284E13) <= upper (1.0).
The fix, in each method, is to check the new value is not on the "wrong" side of the existing "other" value (ie, for minDate, the new min must not be after the existing max. For maxDate, the new max must not be before the existing min). If it is (in either case), both max and min are set to the same, new value. This makes a zero-length range, and avoids the exception.
Log in to post a comment.