maxValue = month.getTotal();
}
}
}
RegionData yearRD[] = new RegionData[years.size()];
for(int y = 0; y < years.size(); y++) {
int activeMonth = -1;
Partition<Partition<CaptureSearchResult>> year = years.get(y);
cal.setTime(year.getStart());
String label = String.valueOf(cal.get(Calendar.YEAR));
List<Partition<CaptureSearchResult>> months = year.list();
if(months.size() != 12) {
throw new RuntimeException("Not 12 months...");
}
int values[] = new int[12];
for(int m = 0; m < 12; m++) {
Partition<CaptureSearchResult> month = months.get(m);
values[m] = normalizeInt(month.getTotal(), maxValue, 15);
if(month.isContainsClosest()) {
activeMonth = m;
}
}
yearRD[y] = new RegionData(label, activeMonth, values);
}
GraphConfiguration config = new GraphConfiguration();
return new Graph(width, height, yearRD, config);
}