display month in abbreviation format

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

display month in abbreviation format

Post by Joanne Li » Tue Jul 23, 2002 4:02 pm

I use the Month(int month, int year) contructor and the month displayed is like "January 2002". And I want it to be like "Jan-2002" as shown in the demo. Anybody know how this works?

Thanks a lot!

Joanne

David Gilbert

Re: display month in abbreviation format

Post by David Gilbert » Tue Jul 23, 2002 4:24 pm

Hi Joanne,

Do you mean the axis labels?

The Month class (a subclass of TimePeriod) can be used to represent your data, but it isn't used by the DateAxis at all. What happens is your Month class will be converted to a Number (actually a Long representing the milliseconds since 1-Jan-1970) and plotted as a value against the axis. The labels on the DateAxis are converted from milliseconds back to Date objects and formatted using a DateFormat object.

You'll find all the formats at the bottom of the DateAxis.java class.

Regards,

DG.

Locked