Page 1 of 1

How do I change the date format for the axis in TimeSeries ?

Posted: Fri Jul 16, 2004 3:56 pm
by AnonymousCoward
I can't figure out how to change :
| |
| |
| |
| |
| |
-----------------------------
03-2004 48-2004 121-2004
(DD-YYYY)

into

| |
| |
| |
| |
| |
|----------------------------
03 48 121
(DD)

is this possible? Thanks for your help in advance.

Posted: Mon Aug 16, 2004 5:31 pm
by hongping
You could try using java.text.SimpleDateFormat:

Code: Select all

String dateFormat = "yyyy/MM/dd HH:mm";
Or if you just want the date

Code: Select all

String dateFormat = "dd";
Then override the dataformat in the horizontal axis:

Code: Select all

XYPlot plot = chart.getXYPlot();
DateAxis axis = (DateAxis) plot.getDomainAxis();
axis.setDateFormatOverride(new SimpleDateFormat(dateFormat));
Hope this helps.