private DataView get_stats() { DataTable dt = new DataTable(); dt.Columns.Add("Function"); dt.Columns.Add("Avg Daily Usage", typeof(double)); dt.Columns.Add("Total Since Reset", typeof(int)); dt.Columns.Add("Your Avg Daily Usage", typeof(double)); dt.Columns.Add("Your Total Since Reset", typeof(int)); dt.Columns.Add("σ", typeof(double)); workDays = WorkDays(); foreach (object item in Enum.GetValues(typeof(CutlistData.Functions))) { string x = Enum.GetName(typeof(CutlistData.Functions), (CutlistData.Functions)item); int f = cd.GetOdometerTotalValue((CutlistData.Functions)item); int mf = cd.GetOdometerValue((CutlistData.Functions)item); double y = f / workDays; double my = mf / workDays; double σ = cd.GetOdometerStdDev((CutlistData.Functions)item); if (y > 0) { DataRow dr = dt.NewRow(); dr["Function"] = x; dr["Avg Daily Usage"] = y; dr["Total Since Reset"] = f; dr["Your Avg Daily Usage"] = my; dr["Your Total Since Reset"] = mf; dr["σ"] = σ; dt.Rows.Add(dr); } } dt.DefaultView.Sort = "[Avg Daily Usage] DESC"; return(dt.DefaultView); }