Ejemplo n.º 1
0
  private TimeSeriesCollection createTotalDataset() {
    List<BigDecimal> values = intervalReport.getValues();
    DateIterator dateIterator = intervalReport.dateIterator();
    List<BigDecimal> inventoryValues = intervalReport.getInventoryValues();
    List<BigDecimal> investmentValues = intervalReport.getInvestmentValues();
    TimeSeries s1 = new TimeSeries(getEditorInput().getName(), Day.class);
    TimeSeries s2 = new TimeSeries("Invested sum", Day.class);
    BigDecimal sum = BigDecimal.ZERO;
    Iterator<BigDecimal> iterator1 = inventoryValues.iterator();
    Iterator<BigDecimal> iterator2 = investmentValues.iterator();
    for (BigDecimal v : values) {
      sum = sum.add(v);
      de.tomsplayground.util.Day d = dateIterator.next();
      Day day = new Day(d.day, d.month + 1, d.year);
      BigDecimal v1 = sum.add(iterator1.next());
      s1.add(day, v1);
      BigDecimal v2 = iterator2.next();
      s2.add(day, v2);
    }
    TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(s1);
    dataset.addSeries(s2);

    return dataset;
  }
Ejemplo n.º 2
0
  private TimeSeriesCollection createGainLossDataset() {
    List<BigDecimal> values = intervalReport.getValues();
    DateIterator dateIterator = intervalReport.dateIterator();
    List<BigDecimal> inventoryValues = intervalReport.getInventoryValues();
    List<BigDecimal> investmentValues = intervalReport.getInvestmentValues();
    TimeSeries s3 = new TimeSeries("Saldo", Day.class);
    BigDecimal sum = BigDecimal.ZERO;
    Iterator<BigDecimal> iterator1 = inventoryValues.iterator();
    Iterator<BigDecimal> iterator2 = investmentValues.iterator();
    for (BigDecimal v : values) {
      sum = sum.add(v);
      de.tomsplayground.util.Day d = dateIterator.next();
      Day day = new Day(d.day, d.month + 1, d.year);
      BigDecimal v1 = sum.add(iterator1.next());
      BigDecimal v2 = iterator2.next();
      s3.add(day, v1.subtract(v2));
    }
    TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(s3);

    return dataset;
  }