我使用jfreechart绘制有关计算机操作记录器的图表。
例如: 1: 2012/09/39/28 06:55:37 8 S 0x1c0c762 终端 --geometry = 134x35 --display:0.0 --role = Terminal-0x10591b0- 16869-1343137248 --show-menubar --show-borders --hide-toolbars - working-directory / home / termier“Terminal”,“Terminal”“Terminal - termier @ akagi:〜” 2: 2012/09/39/28 06:55:41 8 S 0x1600313 / usr / lib / xfce4 / notifyd / xfce4-notifyd “xfce4-notifyd”,“ Xfce4-notifyd“”xfce4-notifyd“
现在,我可以画出每一点(2012/09/39/28 06:55:37,终端),scilicet:x轴是2012/09/39/28 06:55:37,Y -axis是:终端(我使用1来呈现终端,就像其他命令一样,终端... 2:/ usr / lib / xfce4 / notifyd / xfce4-notifyd等...)
但我需要的是绘制一个块,如:
终端1: _ __ _ __ _ _ _S ||||||
/ usr / lib中/ XFCE4 / notifyd / XFCE4-notifyd2: _ __ _ __ _ __ _ ___ _S ||||||
com 3: _ __ _ _S ||||| (S:开始,例如:2000/12/12 09:22:10开始) ..... (当第一个命令结束时,另一个命令将启动,我只能启动,这意味着post命令是上一个命令的结束时间)
但不是:1:S 2:S 3:S
这里有一些代码。
private XYDataset createDataset() {
Calendar precal;
Calendar postcal;
this.flags = modelfocus.getListflag();
commands = modelfocus.getListCommand();
DateFormat formatedate = new SimpleDateFormat("yyyy/MM/ww/dd HH:mm:ss");
precal = Calendar.getInstance();
postcal = Calendar.getInstance();
for (int i = 0; i < countCom; i++) {
this.series[i] = new TimeSeries(commands.get(i));
}
for (Focus listTxt : modelfocus.getList()) {
try {
Date d = new Date();
d = formatedate.parse(listTxt.date2String());
System.out.println(d);
precal.setTime(d);
//postcal.setTime();
} catch (ParseException e) {
System.out.println("Can't change this date");
e.printStackTrace();
}
String eachCmd = listTxt.getCommand();
for (int i = 0; i < countCom; i++) {
if (eachCmd == commands.get(i)) {
series[i].addOrUpdate(new Second(precal.getTime()),
flags.get(i));
}
}
}
TimeSeriesCollection dataset = new TimeSeriesCollection();
for (int i = 0; i < countCom; i++) {
dataset.addSeries(this.series[i]);
}
return dataset;
}
请有人帮忙解决这个问题,非常感谢。
答案 0 :(得分:1)