private void CreateCaloriesGraph(int numberOfEntries) { var calories = json.DeserializeKalorienTag(); var jsonLenght = calories.Count; MyValues.Clear(); TypeOfGraph.Title = "Kalorien"; if (calories.Count == 0) { return; } var helper = jsonLenght - numberOfEntries - 1; for (int i = 0; i <= numberOfEntries - 1; i++) { if (i >= jsonLenght) { break; } if (jsonLenght <= numberOfEntries) { MyValues.Add(new ObservableValue(calories[i].CaloriesDay)); } else { MyValues.Add(new ObservableValue(calories[helper + i].CaloriesDay)); } } }
private void CreateWeightGraph(int numberOfEntries) { var weight = json.DeserializeGewichtTag(); var jsonLenght = weight.Count; MyValues.Clear(); TypeOfGraph.Title = "Gewicht"; if (jsonLenght == 0) { return; } var helper = jsonLenght - numberOfEntries - 1; for (int i = 0; i <= numberOfEntries - 1; i++) { if (i >= jsonLenght) { break; } if (jsonLenght <= numberOfEntries) { MyValues.Add(new ObservableValue(weight[i].TodaysWeight)); } else { MyValues.Add(new ObservableValue(weight[helper + i].TodaysWeight)); } } }