problem with weekly BasicTimeSeries

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

problem with weekly BasicTimeSeries

Post by Han » Tue Oct 08, 2002 5:08 pm

Problem:
I create a weekly BasicTimeSeries, then I add the following:
BasicTimeSeries series = new BasicTimeSeries("s1", Week.class);

Calendar calendar = Calendar.getInstance();
calendar.set(1994, Calendar.DECEMBER, 24);

series.add(new Week(Calendar.getTime()), 55.5);

calendar.set(1994, Calendar.DECEMBER, 31);
series.add(new Week(Calendar.getTime()), 44.4);

then I got an error.

Reason:
The date 1994-12-31 is week 53. When create a new Week for this day, it changes the number of week to 52, then it thinks duplicated date is being added.

How can solve this problem? Thanks!

David Gilbert

Re: problem with weekly BasicTimeSeries

Post by David Gilbert » Tue Oct 08, 2002 5:23 pm

I'm not sure that there is a good answer for this. Perhaps I'll modify the Week class to recognise that there is a 'Week 53', but that it is only 1 day (or 2 days in a leap year) long. Any other suggestions?

Regards,

DG.

Locked