/** * Gets the history entry for each day and transforms it to a <code>JFreeChart</code> entry. * * @param timeDifferenceHours */ protected TimeSeries getBurndownTimeSeries( List<IterationHistoryEntry> iterationHistoryEntries, LocalDate startDate, LocalDate endDate) { TimeSeries burndownSeries = new TimeSeries(BURNDOWN_SERIES_NAME); for (LocalDate iter = startDate.minusDays(1); iter.compareTo(endDate) < 0; iter = iter.plusDays(1)) { IterationHistoryEntry todayEntry = getHistoryEntryForDate(iterationHistoryEntries, iter); IterationHistoryEntry yesterdayEntry = getHistoryEntryForDate(iterationHistoryEntries, iter.minusDays(1)); if (isScopingDone(todayEntry)) { Pair<TimeSeriesDataItem, TimeSeriesDataItem> scopedEntries = getBurndownScopedDataItemForDay(yesterdayEntry, todayEntry); burndownSeries.add(scopedEntries.getFirst()); burndownSeries.add(scopedEntries.getSecond()); } burndownSeries.add(getBurndownDataItemForDay(todayEntry)); } return burndownSeries; }
protected Pair<TimeSeriesDataItem, TimeSeriesDataItem> getBurndownScopedDataItemForDay( IterationHistoryEntry yesterdayEntry, IterationHistoryEntry todayEntry) { DateTime timestamp = todayEntry .getTimestamp() .toDateTimeAtCurrentTime() .minusMinutes(timeDifferenceMinutes) .toDateMidnight() .toDateTime() .plusSeconds(2); Second period = new Second(timestamp.toDate()); long longValue = yesterdayEntry.getEffortLeftSum() + todayEntry.getDeltaOriginalEstimate(); ExactEstimate scopedValue = new ExactEstimate(longValue); TimeSeriesDataItem nullItem = new TimeSeriesDataItem(new Second(timestamp.minusSeconds(1).toDate()), null); TimeSeriesDataItem scopedItem = new TimeSeriesDataItem(period, ExactEstimateUtils.extractMajorUnits(scopedValue)); return Pair.create(nullItem, scopedItem); }