示例#1
0
        private void updateParameters()
        {
            if (NumericN.Value > 0)
            {
                n = (int)NumericN.Value;
            }

            if (NumericM.Value > 0)
            {
                m = (int)NumericM.Value;
            }

            check = n / 2;
            if (NumericCheck.Value < n)
            {
                check = (int)NumericCheck.Value;
            }
            else
            {
                check = (int)NumericN.Value;
            }

            distN = (double)NumericDistN.Value;

            if (NumericP.Value < 100)
            {
                p = (double)NumericP.Value / 100.00;
            }
            else
            {
                p = 0.99;
            }

            // if(NumericEpsilon.Value < 100) eps = (double)NumericEpsilon.Value/200.00;

            if (NumericLambda.Value > 0)
            {
                lambda = (double)NumericLambda.Value;
            }
            if (NumericLambda.Value > NumericN.Value)
            {
                lambda = (double)NumericN.Value;
            }

            sigma = 0.01 * (double)NumericSigma.Value;
            //if(NumericSigma.Value > NumericN.Value) sigma = NumericN.Value;

            A = 0.01 * (double)NumericA.Value;
            B = 0.01 * (double)NumericB.Value;
            L = 0.001 * (double)NumericL.Value;
            //raw_values = new double[n][m]{};
            raw_paths = new List <AlphanumericDataset>(); //[k].ListOfObservations new (List).ToString()<AlphanumericDataset>();
            myds      = new GenericDataset();
            min       = double.MaxValue;
            max       = double.MinValue;
            mean      = 0;
            variance  = 0;
            MyPen     = new List <Pen>();
            prev_X    = new List <int>();
            prev_Y    = new List <int>();
        }
示例#2
0
 public PlotData(GenericDataset ds, int w, int h)
 {
     InitializeComponent(ds, w, h);
 }
示例#3
0
        private void InitializeComponent(GenericDataset myds, int width, int height)
        {
            this.Dataset = myds;
            var DS  = new UnivariateDataset <double>() as IUnivariateDataset;
            var col = new AlphanumericDataset();

            col.Name = "Default X";
            col.ListOfObservations = new List <string>();

            //Console.WriteLine(col.DataType);
            foreach (var i in Enumerable.Range(1, Dataset.GetVariableCount(Dataset.Labels[0])))
            {
                col.ListOfObservations.Add(i.ToString());
            }

            //DS.isNumeric = true;
            DS.Init(col);

            if (!Dataset.UnivariateDatasets.ContainsKey(DS.Name))
            {
                Dataset.UnivariateDatasets.Add(DS.Name, DS);
            }
            else
            {
                DS.Name = DS.Name + "1";
                Dataset.UnivariateDatasets.Add(DS.Name, DS);
            }
            Dataset.Labels.Add(DS.Name);
            Dataset.Log();
            Console.WriteLine("Added {0}", DS.Name);
            this.Width = width;
            int sidebarWidth = (int)(this.Width * 0.3);

            this.PointSettings     = new System.Windows.Forms.GroupBox();
            this.SelectLabel       = new System.Windows.Forms.ComboBox();
            this.PickPointColor    = new System.Windows.Forms.Button();
            this.DisplayPointColor = new System.Windows.Forms.RichTextBox();
            this.DisplayLabel      = new System.Windows.Forms.CheckBox();
            this.PickLabelColor    = new System.Windows.Forms.Button();
            this.DisplayLabelColor = new System.Windows.Forms.RichTextBox();

            this.DisplayLabel.CheckedChanged += new System.EventHandler(this.onDisplayLabelChange);
            MyPlotDataView view = new MyPlotDataView();

            //this.Height = view.PointSettings(0, 0, sidebarWidth, PointSettings, SelectLabel, PickPointColor, DisplayPointColor, DisplayLabel, PickLabelColor, DisplayLabelColor);

            this.VarXSettings  = new System.Windows.Forms.GroupBox();
            this.SelectVarX    = new System.Windows.Forms.ComboBox();
            this.PickXColor    = new System.Windows.Forms.Button();
            this.DisplayXColor = new System.Windows.Forms.RichTextBox();
            this.IntervalX     = new System.Windows.Forms.NumericUpDown();

            this.SelectVarX.SelectedIndexChanged += new System.EventHandler(this.onVarXChange);
            this.IntervalX.Value = 10;
            this.Height          = view.VariableSettings("X", 0, 0, sidebarWidth, VarXSettings, SelectVarX, IntervalX);

            this.VarYSettings  = new System.Windows.Forms.GroupBox();
            this.SelectVarY    = new System.Windows.Forms.ComboBox();
            this.PickYColor    = new System.Windows.Forms.Button();
            this.DisplayYColor = new System.Windows.Forms.RichTextBox();
            this.IntervalY     = new System.Windows.Forms.NumericUpDown();

            this.SelectVarY.SelectedIndexChanged += new System.EventHandler(this.onVarYChange);
            this.IntervalY.Value = 10;
            this.Height         += view.VariableSettings("Y", 0, this.Height, sidebarWidth, VarYSettings, SelectVarY, IntervalY);

            this.ClearChartButton = new System.Windows.Forms.Button();

            this.StatisticsGroupBox     = new System.Windows.Forms.GroupBox();
            this.ContingencyTableButton = new System.Windows.Forms.Button();
            this.PlotDataButton         = new System.Windows.Forms.Button();


            this.ClearChartButton.Click       += new System.EventHandler(this.onClearClick);
            this.PlotDataButton.Click         += new System.EventHandler(this.onPlotClick);
            this.ContingencyTableButton.Click += new System.EventHandler(this.onCTClick);

            this.Height += view.StatisticsControls(0, this.Height, sidebarWidth, StatisticsGroupBox, PlotDataButton, ContingencyTableButton);
            this.PlotDataButton.Text = "Refresh Chart";

            //
            // ClearChartButton Button
            //
            ClearChartButton.Text = "Clear Chart";
            ClearChartButton.Name = "ClearChartButton";

            int ClearChartButtonX = view.marginX;
            int ClearChartButtonY = this.StatisticsGroupBox.Height;

            ClearChartButton.Location = new System.Drawing.Point(ClearChartButtonX, ClearChartButtonY);

            ClearChartButton.Height    = view.stdButtonHeight;
            ClearChartButton.Width     = this.StatisticsGroupBox.Width - 2 * view.marginX;
            StatisticsGroupBox.Height += ClearChartButton.Height + 2 * view.marginY;

            this.Height += ClearChartButton.Height + 2 * view.marginY;

            StatisticsGroupBox.Controls.Add(ClearChartButton);

            this.DisplayDataSettings = new System.Windows.Forms.GroupBox();
            this.DataTable           = new System.Windows.Forms.ListView();

            this.DataTable.View = View.Details;

            MyImportCSV ctr = new MyImportCSV();

            this.Height += ctr.DisplayData(0, this.Height, sidebarWidth, 0, this.DisplayDataSettings, this.DataTable);

            DisplayDataSettings.Text = "Calculated Statistics";

            this.DisplayDataSettings.Anchor = (
                (System.Windows.Forms.AnchorStyles)(
                    (System.Windows.Forms.AnchorStyles.Top) | (System.Windows.Forms.AnchorStyles.Bottom) |
                    (System.Windows.Forms.AnchorStyles.Left)
                    ));
            this.DataTable.Anchor = (
                (System.Windows.Forms.AnchorStyles)(
                    (System.Windows.Forms.AnchorStyles.Top) | (System.Windows.Forms.AnchorStyles.Bottom) |
                    (System.Windows.Forms.AnchorStyles.Left)
                    ));

            this.ChartGroupBox = new System.Windows.Forms.GroupBox();
            this.Chart         = new System.Windows.Forms.PictureBox();

            int temp = view.ChartView(sidebarWidth, 0, width - sidebarWidth, 0, this.ChartGroupBox, this.Chart);

            if (temp > this.Height)
            {
                this.Height = temp;
            }
            else
            {
                this.ChartGroupBox.Height = this.Height - 30;
            }

            this.Controls.Add(this.ChartGroupBox);
            this.Controls.Add(this.DisplayDataSettings);

            this.Controls.Add(this.StatisticsGroupBox);
            this.Controls.Add(this.VarYSettings);
            this.Controls.Add(this.VarXSettings);
            //this.Controls.Add(this.PointSettings);

            this.ClientSize = new System.Drawing.Size(this.Width, this.Height);

            this.Text = "Plot Data";

            InitializeGraphics();

            InitializeLabels();

            InitializeListView();

            InitializeVariables();
        }
示例#4
0
 public PlotData(GenericDataset ds)
 {
     InitializeComponent(ds, 800, 600);
 }
示例#5
0
        //
        // Confirm Click
        //
        private void Confirm()
        {
            Console.WriteLine("confirm");

            if (Columns == null)
            {
                return;
            }

            myds = new GenericDataset();

            foreach (var col in Columns)
            {
                var v2 = col.GetType().GetProperty("DataType").GetValue(col, null);
                //Console.WriteLine(v2);


                if (col.DataType == typeof(int))
                {
                    var DS = new UnivariateDataset <int>() as IUnivariateDataset;

                    DS.Init(col);

                    if (!myds.UnivariateDatasets.ContainsKey(DS.Name))
                    {
                        myds.UnivariateDatasets.Add(DS.Name, DS);
                    }
                    else
                    {
                        DS.Name = DS.Name + "1";
                        myds.UnivariateDatasets.Add(DS.Name, DS);
                    }
                    myds.Labels.Add(DS.Name);
                }
                else if (col.DataType == typeof(double))
                {
                    var DS = new UnivariateDataset <double>() as IUnivariateDataset;

                    DS.Init(col);

                    if (!myds.UnivariateDatasets.ContainsKey(DS.Name))
                    {
                        myds.UnivariateDatasets.Add(DS.Name, DS);
                    }
                    else
                    {
                        DS.Name = DS.Name + "1";
                        myds.UnivariateDatasets.Add(DS.Name, DS);
                    }
                    myds.Labels.Add(DS.Name);
                }
                else if (col.DataType == typeof(DateTime))
                {
                    var DS = new UnivariateDataset <DateTime>() as IUnivariateDataset;

                    DS.Init(col);

                    if (!myds.UnivariateDatasets.ContainsKey(DS.Name))
                    {
                        myds.UnivariateDatasets.Add(DS.Name, DS);
                    }
                    else
                    {
                        DS.Name = DS.Name + "1";
                        myds.UnivariateDatasets.Add(DS.Name, DS);
                    }

                    myds.Labels.Add(DS.Name);
                }
                else if (col.DataType == typeof(string))
                {
                    var DS = new UnivariateDataset <string>() as IUnivariateDataset;

                    DS.Name = col.Name;

                    DS.Init(col);

                    //DS.Log();
                    if (!myds.UnivariateDatasets.ContainsKey(DS.Name))
                    {
                        myds.UnivariateDatasets.Add(DS.Name, DS);
                    }
                    else
                    {
                        DS.Name = DS.Name + "1";
                        myds.UnivariateDatasets.Add(DS.Name, DS);
                    }
                    myds.Labels.Add(DS.Name);
                }
            }

            //myds.Log();
            //StatApp parent = (StatApp)this.Owner;
            //parent.Confirm(myds);
            //this.Close();
        }
示例#6
0
        private void InitializeComponent(GenericDataset ds, int width, int height)
        {
            this.Dataset = ds;
            this.Width   = width;
            int sidebarWidth = (int)(this.Width * 0.3);

            this.PointSettings     = new System.Windows.Forms.GroupBox();
            this.SelectLabel       = new System.Windows.Forms.ComboBox();
            this.PickPointColor    = new System.Windows.Forms.Button();
            this.DisplayPointColor = new System.Windows.Forms.RichTextBox();
            this.DisplayLabel      = new System.Windows.Forms.CheckBox();
            this.PickLabelColor    = new System.Windows.Forms.Button();
            this.DisplayLabelColor = new System.Windows.Forms.RichTextBox();

            this.DisplayLabel.CheckedChanged += new System.EventHandler(this.onDisplayLabelChange);
            MyPlotDataView view = new MyPlotDataView();

            //this.Height = view.PointSettings(0, 0, sidebarWidth, PointSettings, SelectLabel, PickPointColor, DisplayPointColor, DisplayLabel, PickLabelColor, DisplayLabelColor);

            this.VarXSettings  = new System.Windows.Forms.GroupBox();
            this.SelectVar     = new System.Windows.Forms.ComboBox();
            this.PickXColor    = new System.Windows.Forms.Button();
            this.DisplayXColor = new System.Windows.Forms.RichTextBox();
            this.Interval      = new System.Windows.Forms.NumericUpDown();

            this.SelectVar.SelectedIndexChanged += new System.EventHandler(this.onVarXChange);
            this.Interval.ValueChanged          += this.onIntervalChange;

            this.Height = view.VariableSettings("", 0, 0, sidebarWidth, VarXSettings, SelectVar, Interval);

            this.ClearChartButton = new System.Windows.Forms.Button();

            this.StatisticsGroupBox     = new System.Windows.Forms.GroupBox();
            this.ContingencyTableButton = new System.Windows.Forms.Button();
            this.PlotDataButton         = new System.Windows.Forms.Button();


            this.ClearChartButton.Click += new System.EventHandler(this.onClearClick);
            this.PlotDataButton.Click   += new System.EventHandler(this.onPlotClick);

            //this.Height += view.StatisticsControls(0, this.Height, sidebarWidth, StatisticsGroupBox, PlotDataButton, ContingencyTableButton);
            this.PlotDataButton.Text = "Refresh Chart";

            //
            // ClearChartButton Button
            //
            ClearChartButton.Text = "Clear Chart";
            ClearChartButton.Name = "ClearChartButton";

            int ClearChartButtonX = view.marginX;
            int ClearChartButtonY = this.StatisticsGroupBox.Height;

            ClearChartButton.Location = new System.Drawing.Point(ClearChartButtonX, ClearChartButtonY);

            ClearChartButton.Height    = view.stdButtonHeight;
            ClearChartButton.Width     = this.StatisticsGroupBox.Width - 2 * view.marginX;
            StatisticsGroupBox.Height += ClearChartButton.Height + 2 * view.marginY;

            this.Height += ClearChartButton.Height + 2 * view.marginY;

            StatisticsGroupBox.Controls.Add(ClearChartButton);

            this.DisplayDataSettings = new System.Windows.Forms.GroupBox();
            this.DataTable           = new System.Windows.Forms.ListView();

            this.DataTable.View = View.Details;

            MyImportCSV ctr = new MyImportCSV();

            this.Height += ctr.DisplayData(0, this.Height, sidebarWidth, 0, this.DisplayDataSettings, this.DataTable);

            DisplayDataSettings.Text = "Calculated Statistics";

            this.DisplayDataSettings.Anchor = (
                (System.Windows.Forms.AnchorStyles)(
                    (System.Windows.Forms.AnchorStyles.Top) | (System.Windows.Forms.AnchorStyles.Bottom) |
                    (System.Windows.Forms.AnchorStyles.Left)
                    ));
            this.DataTable.Anchor = (
                (System.Windows.Forms.AnchorStyles)(
                    (System.Windows.Forms.AnchorStyles.Top) | (System.Windows.Forms.AnchorStyles.Bottom) |
                    (System.Windows.Forms.AnchorStyles.Left)
                    ));

            this.ChartGroupBox = new System.Windows.Forms.GroupBox();
            this.Chart         = new System.Windows.Forms.PictureBox();

            int temp = view.ChartView(sidebarWidth, 0, width - sidebarWidth, 0, this.ChartGroupBox, this.Chart);

            if (temp > this.Height)
            {
                this.Height = temp;
            }
            else
            {
                this.ChartGroupBox.Height = this.Height - 30;
            }

            this.Controls.Add(this.ChartGroupBox);
            this.Controls.Add(this.DisplayDataSettings);

            //this.Controls.Add(this.StatisticsGroupBox);
            this.Controls.Add(this.VarXSettings);
            //this.Controls.Add(this.PointSettings);

            this.ClientSize = new System.Drawing.Size(this.Width, this.Height);

            this.Text = "Riemann/Lebesgue Integration";

            InitializeGraphics();
            InitializeVariables();
            InitializeListView();

            draw();
        }
示例#7
0
 public FormUA(GenericDataset ds, int w, int h)
 {
     InitializeComponent(ds, w, h);
 }
示例#8
0
 public FormUA(GenericDataset ds)
 {
     InitializeComponent(ds, 800, 600);
 }