TimeSeries and RegularTimePeriod problem...

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
kevdev
Posts: 3
Joined: Fri Jul 15, 2005 1:30 pm

TimeSeries and RegularTimePeriod problem...

Post by kevdev » Fri Jul 15, 2005 3:28 pm

Hello, I have a couple of 'newbie' questions...

I'm creating a TimeSeriesCollection with the TimesSeires being populated from a database. Once i have run my sql query I iterate around the result set, storing the returned values as a java.util.Data and a Double and the try to add to the TimeSeries.

My question is how do i add these values to the TimeSeries if the TimeSeries is expecting the date field to be of type RegularTimePeriod? I cannot seam to cast from java.util.Date to RegularTimePeriod.
Also i do not want to specify the timeperiod value, eg, Year, Quarter, Month, Day etc as the date i am returning is of type Date.

I noticed when JDBCXYDataset i do not have this problem as it adds the resultset to the TimeSeries for you. So how does it do this if the result set is returning a java.sql.Date - surely this has to be cast in to a RegularTimePeriod?

Does anyone have any suggestions? Any help is much appriciated!

Thanks

frank

Good question

Post by frank » Fri Jul 15, 2005 11:40 pm

I need to add my own custom 'date' values.

Jii
Posts: 128
Joined: Thu Apr 21, 2005 11:17 am

Post by Jii » Wed Jul 27, 2005 8:48 am

You can make the RegularTimePerioid using the Date.

For instance:

timeseries.addOrUpdate(new Second(d), value);

Will work just fine.

Locked