Exemplo n.º 1
0
        //
        // Load File
        //
        private void LoadFile(string path)
        {
            this.last_file = path;
            RawDataset     = ParseCSV(path);
            this.rows      = RawDataset.GetLength(0);
            this.cols      = RawDataset.GetLength(1);


            this.Columns = new List <AlphanumericDataset>();
            for (int c = 0; c < cols; c++)
            {
                string name = "X_" + (c).ToString();

                int r  = 0;
                var UD = new AlphanumericDataset();
                UD.ListOfObservations = new List <string>();
                if (ImportLabels.Checked)
                {
                    UD.Name = RawDataset[0, c];
                    r++;
                }
                else
                {
                    UD.Name = name;
                }


                while (r < rows)
                {
                    var obs = RawDataset[r, c];
                    UD.ListOfObservations.Add(obs);
                    r++;
                }

                //UD.Log();
                this.Columns.Add(UD);
            }

            InitializeListView();
        }
Exemplo n.º 2
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();
        }