/** * precondition : 'attribute' MUST contain number values only * * @param cases * @param attribute * @return DefaultXYDataset with all values of 'attribute' against event numbers or timestamps. */ private XYSeriesCollection getDataAttributes( String[] attributes, boolean byTime, double timesize) { XYSeriesCollection result = new XYSeriesCollection(); for (int index = 0; index < attributes.length; index++) { String attribute = attributes[index]; Integer i = 0; XYSeries row = new XYSeries(attribute); for (ProcessInstance pi : mylog.getInstances()) { Integer x = 0; // count event number Date begin = pi.getAuditTrailEntries().first().getTimestamp(); // starting // time // of // process // instance for (AuditTrailEntry ate : pi.getListOfATEs()) { if (ate.getAttributes().containsKey(attribute)) { Double val; val = Double.valueOf(ate.getAttributes().get(attribute)); if (byTime) { row.add(timediff(begin, ate.getTimestamp()) / timesize, val.doubleValue()); } else { row.add(x.doubleValue(), val.doubleValue()); } } x++; // event number in case } i++; // case number } result.addSeries(row); } return result; }
public XYSeries getXYSeries(String rowname, long factor) { XYSeries mydataset = new XYSeries(rowname); for (Integer key : ysum.keySet()) { Double value = ysum.get(key) / (double) count.get(key); Double point = (double) xsum.get(key) / (double) count.get(key); mydataset.add(point / factor, value); } return mydataset; }
private static XYDataset createDataset() { XYSeries xyseries = new XYSeries("First"); xyseries.add(1.0D, 1.0D); xyseries.add(2D, 4D); xyseries.add(3D, 3D); xyseries.add(4D, 5D); xyseries.add(5D, 5D); xyseries.add(6D, 7D); xyseries.add(7D, 7D); xyseries.add(8D, 8D); XYSeries xyseries1 = new XYSeries("Second"); xyseries1.add(1.0D, 5D); xyseries1.add(2D, 7D); xyseries1.add(3D, 6D); xyseries1.add(4D, 8D); xyseries1.add(5D, 4D); xyseries1.add(6D, 4D); xyseries1.add(7D, 2D); xyseries1.add(8D, 1.0D); XYSeries xyseries2 = new XYSeries("Third"); xyseries2.add(3D, 4D); xyseries2.add(4D, 3D); xyseries2.add(5D, 2D); xyseries2.add(6D, 3D); xyseries2.add(7D, 6D); xyseries2.add(8D, 3D); xyseries2.add(9D, 4D); xyseries2.add(10D, 3D); XYSeriesCollection xyseriescollection = new XYSeriesCollection(); xyseriescollection.addSeries(xyseries); xyseriescollection.addSeries(xyseries1); xyseriescollection.addSeries(xyseries2); return xyseriescollection; }