Ejemplo n.º 1
0
 //method to hide buttons, graphs etc.
 private void hide()
 {
     Mdgv.Hide();
     ForecastMlbl.Hide();
     numericUpDown1.Hide();
     numericUpDown2.Hide();
     ForecastRun.Hide();
     ForecastP1.Hide();
     label1.Hide();
     label2.Hide();
     ForecastP2.Hide();
     ForecastP3.Hide();
 }
Ejemplo n.º 2
0
        //method to produce plot titled Forecast vs Actual [A]
        private void plot1(List <double> forecast, List <double> actual, int nsteps, int point)
        {
            ForecastP1.Show();
            ForecastP1.Titles.Clear();
            ForecastP1.Titles.Add(new Title("Forecast vs Actual [A]", Docking.Top, new Font("Verdana", 8f, FontStyle.Bold), Color.Black));
            ForecastP1.ChartAreas[0].AxisY.LabelStyle.Font = ForecastP1.ChartAreas[0].AxisX.LabelStyle.Font = new Font("Arial", 11, GraphicsUnit.Pixel);
            ForecastP1.Legends[0].DockedToChartArea        = "ChartArea1";
            ForecastP1.Series.Clear();
            var series1 = new System.Windows.Forms.DataVisualization.Charting.Series
            {
                Name              = "forecast",
                Color             = System.Drawing.Color.Blue,
                IsVisibleInLegend = true,
                //IsXValueIndexed = true,
                ChartType = SeriesChartType.Line
            };

            this.ForecastP1.Series.Add(series1);
            ForecastP1.Legends[0].DockedToChartArea = "ChartArea1";
            int z = 0;

            foreach (double dd in forecast)
            {
                series1.Points.AddXY(point + z, dd);
                z++;
            }
            var series2 = new System.Windows.Forms.DataVisualization.Charting.Series
            {
                Name              = "actual",
                Color             = System.Drawing.Color.Red,
                IsVisibleInLegend = true,
                //IsXValueIndexed = true,
                ChartType = SeriesChartType.Line
            };

            this.ForecastP1.Series.Add(series2);
            z = 0;
            foreach (double dd in actual)
            {
                series2.Points.AddXY(point + z, dd);
                z++;
            }
            ForecastP1.ChartAreas[0].RecalculateAxesScale();
            ForecastP1.Invalidate();
        }
Ejemplo n.º 3
0
        //this method helps setup the numeric counters
        private void Mdgv_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            System.Windows.Forms.Cursor old = this.Cursor;
            this.Cursor = Cursors.AppStarting;
            ForecastP1.Hide();
            ForecastP2.Hide();
            ForecastP3.Hide();
            numericUpDown1.Show();
            numericUpDown2.Show();
            ForecastRun.Show();
            label1.Show();
            label2.Show();
            //depending on the model that the user chooses, setup the Data list object which will be used elsewhere
            //the numeric counters will be based off of the Data list
            int mposition = 0;

            mposition = Mdgv.SelectedRows[0].Index;
            int  nd       = Modellist[mposition].D;
            bool subtmean = false;

            subtmean = Modellist[mposition].Subtractmean;
            this.Data.Clear();
            if (nd > 0)
            {
                P.DifferencedData.Clear();
                this.P.Diff = nd;
                P.difference();
                foreach (double dd in P.DifferencedData)
                {
                    this.Data.Add(dd);
                }
            }
            else
            {
                List <double> tempdata = new List <double>();
                if (subtmean == true)
                {
                    double aver = P.avg(P.D);
                    foreach (double dd in P.D)
                    {
                        tempdata.Add(dd - P.avg(P.D));
                    }
                }
                else
                {
                    foreach (double dd in P.D)
                    {
                        tempdata.Add(dd);
                    }
                }
                foreach (double dd in tempdata)
                {
                    this.Data.Add(dd);
                }
            }
            //now setup the numeric objects
            int count = Data.Count();

            numericUpDown1.Value     = 1;
            numericUpDown1.Minimum   = 1;
            numericUpDown1.Maximum   = 200;
            numericUpDown1.Increment = 1;
            int nar    = 0;
            int nma    = 0;
            int narchp = 0;
            int narchq = 0;

            nar    = Modellist[mposition].P;
            nma    = Modellist[mposition].Q;
            narchp = Modellist[mposition].archP;
            narchq = Modellist[mposition].archQ;
            int           inc = (int)Math.Floor((double)this.Data.Count() / 500.0);
            List <double> lst = new List <double> {
                (double)nar, (double)nma, (double)narchp, (double)narchq
            };

            numericUpDown2.Minimum   = (int)P.maximum(lst) + 2;
            numericUpDown2.Maximum   = Data.Count();
            numericUpDown2.Value     = Data.Count();
            numericUpDown2.Increment = inc;
            this.Cursor = old;
        }