use of BasicTimeSeries

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

use of BasicTimeSeries

Post by davidmcb » Sun Dec 22, 2002 8:05 pm

I just started using JFreeChart --and having some difficulty getting the BasicTimeSeries to work.

I have one data point per day and want to plot a simple XY Graph.

Here is the code I'm using:

BasicTimeSeries bts = new BasicTimeSeries ("Campaign Count Dataset", Millisecond.class);
String last = "";
if (list != null && list.size() > 0) {
for (Enumeration e = list.elements(); e.hasMoreElements();) {
ZZZ cd = (ZZZ) e.nextElement();
if (!last.equals(cd.DateAdded())) { // DateAdded is mm/dd/yyyy
bts.add(new Millisecond (Dateutil.makeJavaDate(cd.DateAdded(), "mm/dd/yyyy")), Integer.parseInt(cd.EmailCount()) );
last = cd.DateAdded();
}
}
}
return new TimeSeriesCollection(bts);


When this data is plotted, the x-axis shows 1-Jan 00:00 1-Jan 12:00 etc. for each day in Jan only .... and my data points in May June, July ...

What am I missing? .. or doing incorrectly?

Thanks for you help.
David

davidmcb

Re: use of BasicTimeSeries

Post by davidmcb » Sun Dec 22, 2002 10:32 pm

Oops ... i see now my error --> "MM/dd/yyyy" ... makes it all work!

David

David Gilbert

Re: use of BasicTimeSeries

Post by David Gilbert » Mon Dec 23, 2002 9:55 am

Hi David,

If you are using daily data, you might find it easier to use the Day class for your time period in the TimeSeries class. You can use Millisecond, but you don't have to...

Regards,

Dave Gilbert

Locked