【发布时间】:2014-03-17 15:37:35
【问题描述】:
我正在使用 Eclipse e4。我有三个从 GUI 动态输入的时间序列。
/*some code to calculate the entries from a hashmap*/
for (i = 0; i < statValue.length; i++) {
if(statValue[i].equals("MIN"))
{
timeseries[i] = new TimeSeries(entries.getKey()+statValue[i],Second.class);
}
if(statValue[i].equals("MAX"))
{
timeseries[i] = new TimeSeries(entries.getKey()+statValue[i],Second.class);
}
if(statValue[i].equals("AVG"))
{
timeseries[i] = new TimeSeries(entries.getKey()+statValue[i],Second.class);
}
/* some code to calcluate the input to the timeseries */
if(statValue[i].equals("MIN")){
for(Entry<Timestamp,Long> seriesData : MinutesToMin.entrySet()){
System.out.println(new Second(seriesData.getKey())+" "+seriesData.getValue());
timeseries[i].add(new Second(seriesData.getKey()), seriesData.getValue());
}
dataset.addSeries(timeseries[i]);
}
System.out.println("MAX");
if(statValue[i].equals("MAX")){
for(Entry<Timestamp,Long> seriesData : MinutesToMax.entrySet()){
System.out.println(new Second(seriesData.getKey())+" "+seriesData.getValue());
timeseries[i].add(new Second(seriesData.getKey()), seriesData.getValue());
}
dataset.addSeries(timeseries[i]);
}
System.out.println("AVG");
if(statValue[i].equals("AVG")){
for(Entry<Timestamp,Long> seriesData : MinutesToAvg.entrySet()){
System.out.println(new Second(seriesData.getKey())+" "+seriesData.getValue());
timeseries[i].add(new Second(seriesData.getKey()), seriesData.getValue());
}
dataset.addSeries(timeseries[i]);
}
}
在Jfreechart中显示之后的系列。在我的代码中,时间序列可能会根据我从 GUI 中选择的“statValue”而改变。时间序列被动态添加。如果时间序列已经存在,我不想添加它。如何检查时间序列是否已经存在以及是否存在我要删除它。?
【问题讨论】:
标签: eclipse time-series jfreechart e4