/** * Creates the JFreeChart data from the Gantt data * * @param gantt the input data */ private IntervalCategoryDataset createDataset(Gantt gantt) { TaskSeries series = new TaskSeries("Scheduled"); Map<String, Long> seriesDurations = new HashMap<String, Long>(); for (String mapping : gantt.getMappings()) { Task currenttask; currenttask = new Task(mapping, new SimpleTimePeriod(0, 1)); series.add(currenttask); seriesDurations.put(mapping, 0l); } for (GanttElement element : gantt.getElementSet()) { Task t = new Task(element.getTitle(), new SimpleTimePeriod(element.getStart(), element.getEnd())); series.get(element.getMapping()).addSubtask(t); long currentSerieDuration = seriesDurations.get(element.getMapping()); seriesDurations.put(element.getMapping(), Math.max(currentSerieDuration, element.getEnd())); } for (String mapping : seriesDurations.keySet()) { series.get(mapping).setDuration(new SimpleTimePeriod(0, seriesDurations.get(mapping))); } TaskSeriesCollection collection = new TaskSeriesCollection(); collection.add(series); return collection; }