private static void UpdateOverallScore() { chart.SuspendSeriesNotification(); double netWeight = 0; CatsOverall.Clear(); List <CategoryInfo> unboundCats = Globals.SelectedData.UCatInfoSet; InitCatList(); foreach (Assignments a in Asses) { if (a.Grade != "" && a.Grade != "NG" && a.Grade != "X") { foreach (CategoriesBox cb1 in catBoxes) { if (cb1.Description == a.AssignmentType) { if (a.Grade == "Z") { a.Points = 0; } cb1.CatPossible += a.Possible; cb1.CatPoints += a.Points; cb1.Percent = (cb1.CatPoints / cb1.CatPossible); break; } } } } ObservableCollection <CategoriesBox> tempCats = new ObservableCollection <CategoriesBox>(); foreach (CategoriesBox cb1 in catBoxes) { Ot.OverallAll += cb1.Percent * cb1.Weight; if (cb1.Weight > 0 && cb1.CatPossible > 0) { CategoriesBox cbTemp = new CategoriesBox(); cbTemp.CatPoints = cb1.CatPoints; cbTemp.Percent = Math.Round(cb1.Percent, 2); cbTemp.CatPossible = cb1.CatPossible; cbTemp.Weight = cb1.Weight; cbTemp.Description = cb1.Description; cbTemp.WeightPercent = Math.Round((cbTemp.Percent * cbTemp.Weight), 2); cbTemp.DelWeight = cbTemp.Weight - cbTemp.WeightPercent; cbTemp.CatColor = ColorGet.ColorFromPercent((int)Math.Round(cbTemp.Percent * 100, 0)); tempCats.Add(cbTemp); netWeight += cb1.Weight; } } Ot.OverallAll = Math.Round((100 * Ot.OverallAll) / netWeight, 2); if (catBoxes.Count >= 2) { if (tempCats.Count >= 2) { CategoriesBox overall = new CategoriesBox(); overall.Percent = Ot.OverallAll; overall.Weight = 100; overall.Description = "Overall"; overall.WeightPercent = overall.Percent; overall.CatColor = ColorGet.ColorFromPercent((int)Math.Round(Ot.OverallAll, 0)); tempCats.Add(overall); } } ColorModel.Palette = ChartColorPalette.Custom; ChartColorCollection cmc = new ChartColorCollection(); foreach (CategoriesBox cv in tempCats) { cmc.Add(cv.CatColor); } ColorModel.CustomBrushes = cmc; Ot.OverallColor = ColorGet.ColorFromPercent((int)Math.Round(Ot.OverallAll, 0)); Ot.CatsOverall = tempCats; chart.ResumeSeriesNotification(); }