@Override
public DatasetMap calculateValue() throws Exception {
logger.debug("IN");
DatasetMap datasets = super.calculateValue();
if(datasets==null || yearsDefined==null){
logger.error("Error in TrargetCharts calculate value");
return null;
}
TimeSeriesCollection dataset = new TimeSeriesCollection();
if(datasets!=null && yearsDefined.isEmpty()){
logger.warn("no rows found with dataset");
}
else{
int itemCount = timeSeries.getItemCount();
// this is the main time series, to be linked with Line and shape
dataset.addSeries(timeSeries);
// Check if defining target and baseline
Double mainTarget=null;
Double mainBaseline=null;
if(useTargets)mainTarget=mainThreshold;
else mainBaseline=mainThreshold;
// run all the years defined
lastIndexMonth = 1;
for (Iterator iterator = yearsDefined.iterator(); iterator.hasNext();) {
String currentYearS = (String) iterator.next();
int currentYear=Integer.valueOf(currentYearS).intValue();
// get the last in l
for(int i = 1; i < 13; i++) {
TimeSeriesDataItem item = timeSeries.getDataItem(new Month(i, currentYear));
if(item == null || item.getValue() == null) {
//timeSeries.addOrUpdate(new Month(i, currentYear), null);
} else {
lastIndexMonth = i;
}
}
}
}
datasets.addDataset("1",dataset);
logger.debug("OUT");
return datasets;
}