Пример #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;
  }