Can someone tell me if I am doing something wrong here? I am trying to create a time series chart based on minutes. I am using this code:
TimeSeriesCollection data = new TimeSeriesCollection();
BasicTimeSeries data1 = new BasicTimeSeries("Web Server");
try{
Day day = new Day(1,SerialDate.JANUARY,2002);
data1.add(new Minute(30,day),new Double(0.0));
data1.add(new Minute(60,day),new Double(1.0));
data1.add(new Minute(90,day),new Double(2.0));
data1.add(new Minute(120,day),new Double(0.0));
}
I get this error:
TimeSeries.add(...): inconsistent time period class.
If I change it to a Day based time series, like below, it works fine. I couldn't find any other problems listed that were similar.
data1.add(new Day(1,SerialDate.JANUARY,2002),new Double(0.0));
data1.add(new Day(2,SerialDate.JANUARY,2002),new Double(1.0));
data1.add(new Day(3,SerialDate.JANUARY,2002),new Double(2.0));
data1.add(new Day(4,SerialDate.JANUARY,2002),new Double(0.0));
Trouble using Minute class in TimeSeries
Re: Trouble using Minute class in TimeSeries
Hi Pat,
Every BasicTimeSeries instance has a time period class. The constructor you have used creates a daily time series. You need to change the line to:
BasicTimeSeries data1 = new BasicTimeSeries("Web Server", Minute.class);
I couldn't think of a better way to prevent people from mixing different subclasses of TimePeriod in one series...
Regards,
DG.
Every BasicTimeSeries instance has a time period class. The constructor you have used creates a daily time series. You need to change the line to:
BasicTimeSeries data1 = new BasicTimeSeries("Web Server", Minute.class);
I couldn't think of a better way to prevent people from mixing different subclasses of TimePeriod in one series...
Regards,
DG.