Esempio n. 1
0
        public IndividualGraph(PetManager PM, int listValue, float totalFood, float foodToPriceRatio)
        {
            // Creating graph
            InitializeComponent();
            pm = PM;

            pm.totalPets[listValue].WeeklyAvg(totalFood, foodToPriceRatio * totalFood);

            foreach (float weeklyAverage in pm.totalPets[listValue].AverageDailyConsumption)
            {
                DataPoint Dp = new DataPoint();
                Dp.SetValueY(weeklyAverage);
                yValues.Add(Dp);
            }

            chart1.Series.Clear();
            chart1.Series.Add("Food");
            foreach (DataPoint dP in yValues)
            {
                chart1.Series["Food"].Points.Add(dP);
            }
            chart1.Series["Food"].ChartType = SeriesChartType.Line;

            // finished creating graph


            // form the list
            float totalCost = 0;
            Font  font      = new Font(new System.Drawing.FontFamily("Palatino Linotype"), 11); // font

            for (int i = 0; i < pm.totalPets[listValue].AverageDailyConsumption.Count; i++)
            {
                Label point = new Label(); // create label and apply text and settings
                point.Text     = "Week 1 2 3 4 5 6 7 8 9 10" + Convert.ToString(i + 1) + ": " + pm.totalPets[listValue].AverageDailyConsumption[i].ToString("n0") + "g    -    " + pm.totalPets[listValue].TotalWeeklyPrices[i];
                totalCost     += pm.totalPets[listValue].TotalWeeklyPrices[i];
                point.Font     = font;
                point.Location = new Point(10, cnp_controller.Controls.Count * 20);

                cnp_controller.Controls.Add(point);
            }

            nameTtl.Text      = pm.totalPets[listValue].name + "'s Weekly Averages";
            totalCostLbl.Text = "Total Cost: $" + totalCost;
        }
Esempio n. 2
0
 //form initialization
 public Form1(PetManager PM)
 {
     InitializeComponent();
     pm = PM;
 }
Esempio n. 3
0
 public DetailsForm(PetManager PM, int type)
 {
     InitializeComponent();
     pm            = PM;
     getAnimalInfo = type;
 }