private DefaultCategoryDataset createDataset() { DefaultCategoryDataset defaultCategoryDataset = new DefaultCategoryDataset(); for (String key : histogram.keySet()) { defaultCategoryDataset.addValue(histogram.get(key), "", key); } return defaultCategoryDataset; }
public void actionPerformed(ActionEvent event) { Object source = new Object(); source = event.getSource(); String data, histo = ""; if (source == btnRun) { Histogram gram = new Histogram(txtWord.getText()); data = gram.getData(); histo = gram.getHistogram(); JOptionPane.showMessageDialog(null, data + "\n" + histo); } }
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; }