float KillSome() { float deaths = 0; for (int i = 0; i < ageDistribution.GetPointCount(); i++) { float loss = GetLossOfPeopleOfAge(ageDistribution.GetValue(i), i); ageDistribution.GhostChangePoint(i, ageDistribution.GetValue(i) - loss); deaths += loss; } ageDistribution.UpdateBiggestYValue(); return(deaths); }
void OnChanceOfDeathUpdated() { for (int i = (int)chanceOfDeath.GetBiggestXValue() - ageDistribution.GetPointCount(); i > 0; i--) { ageDistribution.AddPoint(0); } how1000PeopleDie.RemovePointAndAfter(0); for (int i = 0; i <= chanceOfDeath.GetBiggestXValue(); i++) { for (int j = 0; j < i; j++) { float oldPop = how1000PeopleDie.GetValue(j); how1000PeopleDie.GhostChangePoint(j, oldPop - GetLossOfPeopleOfAge(oldPop, j)); } how1000PeopleDie.InsertPoint(0, 1000); how1000PeopleDie.UpdateBiggestYValue(); } chanceOfDeathChart.UpdateScale(); chanceOfDeathChart.QueueDraw(); }