public int FindIndexOfMin(List <XYPOINT> xyPoints) { int indexOfMin = 0; XYPOINT min = xyPoints[0]; for (int i = 0; i < xyPoints.Count; i++) { if (xyPoints[i].X < min.X) { min = xyPoints[i]; indexOfMin = i; } } return(indexOfMin); }
public int FindIndexOfMax(List <XYPOINT> xyPoints) { int indexOfMax = 0; XYPOINT max = xyPoints[0]; for (int i = 0; i < xyPoints.Count; i++) { if (xyPoints[i].X > max.X) { max = xyPoints[i]; indexOfMax = i; } } return(indexOfMax); }
public List <XYPOINT> MakeXYPOINTS(List <ArchivedOffering> archivedOfferings) { List <XYPOINT> xypoints = new List <XYPOINT>(); foreach (var archive in archivedOfferings) { double aoPrice = (double)archive.Price; XYPOINT xyPoint = new XYPOINT(); xyPoint.X = archive.Date.DayOfYear; xyPoint.Y = aoPrice; xypoints.Add(xyPoint); } xypoints = xypoints.OrderBy(x => x.X).ToList(); return(xypoints); }