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; }
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; }
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; }