/**
   * 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;
  }
Exemplo n.º 2
0
 /** Creates fundamental diagram chart. */
 private JFreeChart makeFDChart() {
   updateFDSeries();
   XYSeriesCollection dataset = new XYSeriesCollection();
   dataset.addSeries(ffFD);
   dataset.addSeries(cFD);
   dataset.addSeries(cdFD);
   JFreeChart chart =
       ChartFactory.createXYLineChart(
           null, // chart title
           "Density (vpm)", // x axis label
           "Flow (vph)", // y axis label
           dataset, // data
           PlotOrientation.VERTICAL,
           false, // include legend
           false, // tooltips
           false // urls
           );
   XYPlot plot = (XYPlot) chart.getPlot();
   plot.getRenderer().setSeriesPaint(0, Color.GREEN);
   plot.getRenderer().setSeriesPaint(1, Color.RED);
   plot.getRenderer().setSeriesPaint(2, Color.BLUE);
   plot.getRenderer().setStroke(new BasicStroke(2));
   return chart;
 }
 private IntervalXYDataset getHistrogrammedDataAttributes(
     String[] attributes, long barsize, long timesize) {
   IntervalXYDataset dataset = null;
   if (no_intervals) {
     dataset = new XYSeriesCollection();
   } else {
     dataset = new YIntervalSeriesCollection();
   }
   for (int index = 0; index < attributes.length; index++) {
     Histogram histogram = new Histogram(barsize);
     String attribute = attributes[index];
     for (ProcessInstance pi : mylog.getInstances()) {
       Date begin;
       try {
         begin = pi.getAuditTrailEntryList().get(0).getTimestamp();
       } catch (Exception e) {
         Message.add(e.getMessage(), Message.ERROR);
         return null;
       } // starting time of process instance
       int j = 0;
       for (AuditTrailEntry ate : pi.getListOfATEs()) {
         if (ate.getAttributes().containsKey(attribute)) {
           Double val;
           val = Double.valueOf(ate.getAttributes().get(attribute));
           if (xbox.getSelectedIndex() == 2) {
             histogram.addValue(j, val);
           }
           if (xbox.getSelectedIndex() == 3) {
             histogram.addValue(timediff(begin, ate.getTimestamp()), val);
           }
           j++;
         }
       }
     }
     if (no_intervals) {
       ((XYSeriesCollection) dataset).addSeries(histogram.getXYSeries(attribute, timesize));
     } else {
       ((YIntervalSeriesCollection) dataset)
           .addSeries(histogram.getYIntervalSeries(attribute, timesize));
     }
   }
   return dataset;
 }