예제 #1
0
  private Chart buildDistanceChart(List<Fuel> records) {
    Chart distanceList = new Chart();
    DateValueChart chartRow;
    for (Fuel record : records) {
      chartRow = new DateValueChart();
      chartRow.setDate(record.getDate());
      chartRow.setValue(record.getDistance());
      distanceList.add(chartRow);
    }

    return distanceList;
  }
예제 #2
0
  private Chart buildRefuelChart(List<Fuel> records) {
    Chart refuelList = new Chart();
    DateValueChart chartRow;
    for (Fuel record : records) {
      chartRow = new DateValueChart();
      chartRow.setDate(record.getDate());
      chartRow.setValue(record.getLiters());
      refuelList.add(chartRow);
    }

    return refuelList;
  }
예제 #3
0
  private Chart buildConsumptionChart(List<Fuel> records) {

    Chart consumptionList = new Chart();

    int id = 0;
    for (Fuel record : records) {
      ConsumptionChart consumptionChart = new ConsumptionChart();
      consumptionChart.setInterval(id++);
      consumptionChart.setValue(consumption(record.getLiters(), record.getDistance()));
      consumptionList.add(consumptionChart);
    }
    return consumptionList;
  }