hi all ... just got this s/w latest night and it really plot well. but now i'm facing some problem with the BasicTimeSeries Class which is used to plot the time series graph. i just do some modification on the demo code "DemoDatasetFactory.java" ... here is my code ...
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.FileReader;
import com.jrefinery.data.*;
import com.jrefinery.date.*;
public class PruDatasetFactory {
/**
* Returns a dataset consisting of one annual series.
*/
public static TimeSeriesCollection createSar_w_data() {
BasicTimeSeries t1 = new BasicTimeSeries("Daily", "Second", "Value", Minute.class);
String s = null;
int min=0;
try {
BufferedReader in = new BufferedReader(new FileReader("w.20011229"));
while ((s=in.readLine())!=null) { // read out the header
s.trim();
if (!s.startsWith("#") && !s.startsWith("A") && s.length()>0) {
StringTokenizer sth = new StringTokenizer(s);
String tmph;
tmph=sth.nextToken();
tmph=sth.nextToken();
if (tmph.equals("cswch/s"))
break;
}
}
while ((s=in.readLine())!=null) { // read all data
s.trim();
if (!s.startsWith("#") && !s.startsWith("A") && s.length()>0) {
StringTokenizer st = new StringTokenizer(s);
String tmp;
//00:01:01 runq-sz %runocc swpq-sz %swpocc
tmp=st.nextToken();
//min=Integer.parseInt(tmp.substring(3,5));
System.out.println(Integer.toString(min));
tmp=st.nextToken(); // data
t1.add( new Minute( new Day(29,12,2001), min ), new Integer(tmp) );
min+=2;
}
}
}
catch (Exception e) {
System.out.println(e.getMessage());
}
return new TimeSeriesCollection(t1);
}
the program does runs but the starting time of the graph is 8:00am (29 of month 12, 2001) am to 8:00 am (30 of month 12, 2001).
from these lines of code ...
min=0;
...
t1.add( new Minute( new Day(29,12,2001), min ), new Integer(tmp) );
min+=2;
what i expect is that it should start ploting the graph from 0:00am (29 of month 12, 2001) am to 0:00 am (30 of month 12, 2001).
now, is there any settings that we can set on the starting time for the graph ???
c who can help...
many thanks
BasicTimeSeries Class ???
RE: BasicTimeSeries Class ???
My guess is that the time zone is causing the difference...I haven't really thought much about how that should be handled yet...
DG.
DG.