min & max dates not displayed in HorizontalDateAxis

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
morpheus

min & max dates not displayed in HorizontalDateAxis

Post by morpheus » Tue Feb 18, 2003 1:19 pm

Hi,

I defined the following tick unit :

xAxis.setTickUnit( new DateTickUnit( DateTickUnit.DAY, 3, new SimpleDateFormat( "dd-MMM-yy" ) ) );

The minimum date value is : 01-Dic-2002
The maximum date value is : 31-Dic-2002

The following tick marks labels are displayed 03-dic-02, 06-dic-02, 09-dic-12, 15-dic-02, 18-dic-02, 21-dic-02, 24-dic-02, 27-dic-02, 30-dic-02, but minimum and maximum date tick labels are not displayed!. Is there a way to force them to be displayed ?

Regards
Morpheus

David Gilbert

Re: min & max dates not displayed in HorizontalDateAxis

Post by David Gilbert » Tue Feb 18, 2003 4:11 pm

No, there isn't. To see what is going on in the code, look into the previousStandardDate(...) and nextStandardDate(...) methods in the DateAxis class. It's possible that there may be ways to improve how these methods behave...suggestions are welcome.

Regards,

DG

morpheus

Re: min & max dates not displayed in HorizontalDateAxis

Post by morpheus » Tue Feb 18, 2003 4:50 pm

Why calculateLowestVisibleTickValue doesn't return getMinimumDate() and calculateHighestVisibleTickValue doesn't return getMaximumDate() ?

If I'm not wrong autoRange and autoTickSelection dosen't change the fact that we always start from min date and finish at max date, am I wrong?

public Date calculateLowestVisibleTickValue(DateTickUnit unit) {

return nextStandardDate(getMinimumDate(), unit);

}


public Date calculateHighestVisibleTickValue(DateTickUnit unit) {

return previousStandardDate(getMaximumDate(), unit);

}


Regards
Morpheus

morpheus

Re: min & max dates not displayed in HorizontalDateAxis

Post by morpheus » Tue Feb 18, 2003 4:52 pm

Why calculateLowestVisibleTickValue doesn't return getMinimumDate() and calculateHighestVisibleTickValue doesn't return getMaximumDate() ?

If I'm not wrong autoRange and autoTickSelection dosen't change the fact that we always start from min date and finish at max date, am I wrong?

public Date calculateLowestVisibleTickValue(DateTickUnit unit) {

return nextStandardDate(getMinimumDate(), unit);

}


public Date calculateHighestVisibleTickValue(DateTickUnit unit) {

return previousStandardDate(getMaximumDate(), unit);

}


Regards
Morpheus

David Gilbert

Re: min & max dates not displayed in HorizontalDateAxis

Post by David Gilbert » Tue Feb 18, 2003 5:06 pm

You have to keep in mind that the code has to handle very general cases. What if the minimum "date" is 2003-04-26 15:45.34 and you request tick units at 10 minute intervals? Then the first tick label should show 15:50, followed by 16:00, but by your suggestion it would show 15:45.34, followed by 15:55.34.

Regards,

DG

morpheus

Re: min & max dates not displayed in HorizontalDateAxis

Post by morpheus » Wed Feb 19, 2003 1:52 pm

Ok, I understand what u mean. Rounding Hour, Minutes, Seconds, milliseconds is understandable but I don't understand why Year, Month, Day are rounded, especially if dates are retreived from Database. In this case Min and Max Date should be displayed in the HorizontalDateAxis.

Maybe adding methods that allow adding TickMark manually would be a solution.

Regards
Morpheus

Locked