/** Assembles all the needed <code>TimeSeries</code>. */
  protected TimeSeriesCollection getDataset(Iteration iteration) {
    TimeSeriesCollection chartDataset = new TimeSeriesCollection();

    List<IterationHistoryEntry> iterationEntries =
        iterationHistoryEntryBusiness.getHistoryEntriesForIteration(iteration);

    LocalDate yesterday = new LocalDate().minusDays(1);
    LocalDate today = new LocalDate();
    IterationHistoryEntry yesterdayEntry = getHistoryEntryForDate(iterationEntries, yesterday);
    IterationHistoryEntry todayEntry = getHistoryEntryForDate(iterationEntries, today);
    DateTime iterationStartDate = new DateTime(iteration.getStartDate());
    DateTime iterationEndDate = new DateTime(iteration.getEndDate());

    chartDataset.addSeries(
        getBurndownTimeSeries(
            iterationEntries,
            new LocalDate(iteration.getStartDate()),
            determineEndDate(new LocalDate(iteration.getEndDate()))));

    chartDataset.addSeries(getCurrentDayTimeSeries(yesterdayEntry, todayEntry));

    chartDataset.addSeries(
        getScopingTimeSeries(
            iterationEntries, iterationStartDate.toLocalDate(), iterationEndDate.toLocalDate()));

    chartDataset.addSeries(
        getReferenceVelocityTimeSeries(
            iterationStartDate,
            iterationEndDate,
            new ExactEstimate(todayEntry.getOriginalEstimateSum())));

    TimeSeries predictedVelocity =
        getPredictedVelocityTimeSeries(
            iterationStartDate.toLocalDate(),
            iterationEndDate.toLocalDate(),
            yesterdayEntry,
            todayEntry);
    if (predictedVelocity != null) {
      chartDataset.addSeries(predictedVelocity);
    }

    return chartDataset;
  }
 protected List<IterationHistoryEntry> getIterationHistoryEntries(Iteration iteration) {
   return iterationHistoryEntryBusiness.getHistoryEntriesForIteration(iteration);
 }