Help!

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

Help!

Post by paul » Fri Oct 11, 2002 9:20 pm

Hi Im new to jfreechart and it looks real neat. is there a dataset that I can just associate a timestamp with data? I see all this minute, hour, quarter stuff and Im really confused. I bought the documentation and am even more confused. All help is appreciated! :)

Dave Gilbert

Re: Help!

Post by Dave Gilbert » Mon Oct 14, 2002 12:22 pm

Hi Paul,

Have a look at the classes TimeSeriesDemo1, TimeSeriesDemo2, etc. in the src/com/jrefinery/chart/demo directory. They show you how to create a time series with different time periods.

If you want to use an arbitrary timestamp, then use the FixedMillisecond time period subclass. It is really just a wrapper for java.util.Date. It would go something like this:

BasicTimeSeries s1 = new BasicTimeSeries("S1", FixedMillisecond.class);
s1.add(new FixedMillisecond(date1), 181.8);
s1.add(new FixedMillisecond(date2), 167.3);
...
TimeSeriesCollection collection = new TimeSeriesCollection(s1);

where date1 and date2 are any (distinct) instances of java.util.Date.

Regards,

DG.

Locked