Beispiel #1
0
 void AgeEveryone(float newborns)
 {
     ageDistribution.InsertPoint(0, newborns);
     if (ageDistribution.GetPointCount() > (int)chanceOfDeath.GetBiggestXValue())
     {
         ageDistribution.RemovePointAndAfter((int)chanceOfDeath.GetBiggestXValue() + 1);
     }
     ageDistributionChart.UpdateScale();
     ageDistributionChart.QueueDraw();
 }
Beispiel #2
0
        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();
        }