Exemplo n.º 1
0
        //method to produce plot titled Simulation: 100 Paths
        private void plot3(List <List <double> > simulations, int nsteps, int point)
        {
            int i = 0;

            i = simulations.Count();
            ForecastP3.Show();
            ForecastP3.Titles.Clear();
            ForecastP3.Titles.Add(new Title("Simulation: 100 Paths", Docking.Top, new Font("Verdana", 8f, FontStyle.Bold), Color.Black));
            ForecastP3.ChartAreas[0].AxisY.LabelStyle.Font = ForecastP3.ChartAreas[0].AxisX.LabelStyle.Font = new Font("Arial", 11, GraphicsUnit.Pixel);
            ForecastP3.Legends[0].DockedToChartArea        = "ChartArea1";
            ForecastP3.Series.Clear();
            for (int j = 0; j < i; j++)
            {
                int    q      = 1 + j;
                string nam    = "Simulation " + q.ToString();
                var    series = new System.Windows.Forms.DataVisualization.Charting.Series
                {
                    Name              = nam,
                    Color             = System.Drawing.Color.Blue,
                    IsVisibleInLegend = false,
                    //IsXValueIndexed = true,
                    ChartType = SeriesChartType.Line
                };
                this.ForecastP3.Series.Add(series);
                ForecastP3.Legends[0].DockedToChartArea = "ChartArea1";
                int z = 0;
                foreach (double dd in simulations[j])
                {
                    series.Points.AddXY(point + z, dd);
                    z++;
                }
                ForecastP3.ChartAreas[0].RecalculateAxesScale();
                ForecastP3.Invalidate();
            }
        }
Exemplo n.º 2
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();
 }
Exemplo 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;
        }