Formatting the labels for a timeseries chart

Discussion about JFreeChart related to stockmarket charts.
Locked
am
Posts: 22
Joined: Mon May 09, 2005 4:56 pm

Formatting the labels for a timeseries chart

Post by am » Mon May 09, 2005 5:01 pm

How do you forma the x-axis?
I have the values in milliseconds and am wanting to convert these to hh:mm:dd:yy, i still want to plot to millisecond accuracy but want the labels to be viewed like explained???
Anyone got any ideas??? :oops:

bhargavi

Post by bhargavi » Tue Jul 19, 2005 7:14 am

take java.util .date objects and format to ur required format and then set them as date tick units
i had the same requirement but with is below code it is working


idt = new java.util.Date();
idt.setDate(1);
idt.setMonth(0);
idt.setYear(0);
idt.setHours(0);
idt.setMinutes(0);
idt.setSeconds(0);

idt1 = new java.util.Date();
idt1.setDate(2);
idt1.setMonth(0);
idt1.setYear(0);
idt1.setHours(0);
idt1.setMinutes(0);
idt1.setSeconds(0);
//String idt = "1900-01-01 00:00:00";
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
SimpleDateFormat sdf1 = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
DateAxis timeAxis = new DateAxis("");
DateTickUnit dtu = new DateTickUnit(DateTickUnit.SECOND,3600,sdf);
timeAxis.setTickUnit(dtu);

Locked