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
use of BasicTimeSeries
Re: use of BasicTimeSeries
Oops ... i see now my error --> "MM/dd/yyyy" ... makes it all work!
David
David
Re: use of BasicTimeSeries
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
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