// loads all eligible end intervals based the farthest end interval of all patients in all series public void loadEndIntervals() { int currentHighestInterval = 0; foreach (ChartSeries series in ChartSeries) { List <Patient> patients = series.getPatients(); foreach (Patient patient in patients) { List <PatientOutcome> patientOutcomes = database.getPatientOutcome(patient); foreach (PatientOutcome po in patientOutcomes) { if (po.Interval_Number > currentHighestInterval) { currentHighestInterval = po.Interval_Number; } } } } int intervalLength = SelectedProtocol.Interval__Months_; for (int i = 0; i <= currentHighestInterval; i++) { EndIntervals.Add(new Interval(i, intervalLength)); } }