new String[]{"Completed", "Failed", "Terminated"}, timespan, true, completed, failed, terminated);
}
private static String createDatasetJSO(String[] title, Timespan timespan, boolean matchParity, List<Event>... events) {
XYDataSetJSO dataSet = new XYDataSetJSO(
title,
UUID.randomUUID().toString()
);
for(List<Event> subset : events)
{
SortedMap<Date, List<Event>> grouped = group(timespan, subset);
List<Long> domainData = new ArrayList<Long>(grouped.size());
List<Long> rangeData = new ArrayList<Long>(grouped.size());
for(Date d : grouped.keySet())
{
domainData.add(d.getTime());
// if parity matched datasets, then we get Open and Closed events.
int actualSize = matchParity ? grouped.get(d).size()/2 : grouped.get(d).size();
rangeData.add(new Integer(actualSize).longValue());
}
dataSet.getDomain().add(domainData);
dataSet.getRange().add(rangeData);
}
dataSet.setAxis("date");
return dataSet.toJSO();
}