//Variable selection changed
    //Add or remove data row
    private void CheckedItemsChanged(object sender, CollectionItemsChangedEventArgs<IndexedItem<StringValue>> checkedItems) {

      foreach (IndexedItem<StringValue> item in checkedItems.Items) {
        string variableName = item.Value.Value;

        //variable is displayed -> remove
        if (VariableIsDisplayed(variableName)) {
          dataTable.Rows.Remove(variableName);
          dataTable.SelectedRows.Remove(variableName);
          dataTablePerVariable.Remove(dataTablePerVariable.Find(x => (x.Name == variableName)));
          //variable isnt't displayed -> add
        } else {
          DataRow row = GetDataRow(variableName);
          DataRow selectedRow = GetSelectedDataRow(variableName);
          dataTable.Rows.Add(row);

          PreprocessingDataTable pdt = new PreprocessingDataTable(variableName);
          pdt.Rows.Add(row);
          dataTablePerVariable.Add(pdt);

          //update selection
          if (selectedRow != null) {
            dataTable.SelectedRows.Add(selectedRow);
            pdt.SelectedRows.Add(selectedRow);
          }
        }
      }

      // update chart if not in all in one mode
      if (Content != null && !Content.AllInOneMode)
        GenerateChart();

    }
Esempio n. 2
0
        private void addChartsToTableLayoutPanel()
        {
            List <string> variables = Content.PreprocessingData.GetDoubleVariableNames().ToList();

            //set scatter plots and histograms
            for (int x = 1; x < variables.Count + 1; x++)
            {
                for (int y = 1; y < variables.Count + 1; y++)
                {
                    // use historgram if x and y variable are equal
                    if (x == y)
                    {
                        PreprocessingDataTable dataTable = new PreprocessingDataTable();
                        DataRow dataRow = Content.CreateDataRow(variables[x - 1], DataRowVisualProperties.DataRowChartType.Histogram);
                        dataTable.Rows.Add(dataRow);
                        PreprocessingDataTableView pcv = new PreprocessingDataTableView();
                        pcv.ChartDoubleClick += HistogramDoubleClick;
                        pcv.Content           = dataTable;
                        tableLayoutPanel.Controls.Add(pcv, y, x);
                    }
                    //scatter plot
                    else
                    {
                        ScatterPlot scatterPlot           = Content.CreateScatterPlot(variables[x - 1], variables[y - 1]);
                        PreprocessingScatterPlotView pspv = new PreprocessingScatterPlotView();
                        pspv.ChartDoubleClick += ScatterPlotDoubleClick;
                        pspv.Content           = scatterPlot;
                        pspv.Dock              = DockStyle.Fill;
                        tableLayoutPanel.Controls.Add(pspv, x, y);
                    }
                }
            }
        }
Esempio n. 3
0
        //open histogram in new tab with new content when double clicked
        private void HistogramDoubleClick(object sender, EventArgs e)
        {
            PreprocessingDataTableView pcv          = (PreprocessingDataTableView)sender;
            HistogramContent           histoContent = new HistogramContent(Content.PreprocessingData); // create new content

            histoContent.VariableItemList = Content.CreateVariableItemList();
            PreprocessingDataTable dataTable = pcv.Content;

            setVariableItemListFromDataTable(histoContent, dataTable);

            MainFormManager.MainForm.ShowContent(histoContent, typeof(HistogramView)); // open in new tab
        }
        private void GenerateMultiChartLayout()
        {
            int checkedItemsCnt = 0;

            foreach (var item in Content.VariableItemList.CheckedItems)
            {
                checkedItemsCnt++;
            }

            // set columns and rows based on number of items
            int columns = GetNrOfMultiChartColumns(checkedItemsCnt);
            int rows    = GetNrOfMultiChartRows(checkedItemsCnt, columns);

            tableLayoutPanel.ColumnCount = columns;
            tableLayoutPanel.RowCount    = rows;

            List <PreprocessingDataTable> .Enumerator enumerator = dataTablePerVariable.GetEnumerator();
            for (int x = 0; x < columns; x++)
            {
                if (rows <= MAX_TABLE_AUTO_SIZE_ROWS)
                {
                    tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100 / columns));
                }
                else
                {
                    //scrollbar is shown if there are more than 3 rows -> remove scroll bar width from total width
                    tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, (tableLayoutPanel.Width - System.Windows.Forms.SystemInformation.VerticalScrollBarWidth) / columns));
                }
                for (int y = 0; y < rows; y++)
                {
                    //Add a row only when creating the first column
                    if (x == 0)
                    {
                        // fixed chart size when there are more than 3 tables
                        if (rows > MAX_TABLE_AUTO_SIZE_ROWS)
                        {
                            tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, FIXED_CHART_SIZE));
                        }
                        else
                        {
                            tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100 / rows));
                        }
                    }

                    enumerator.MoveNext();
                    PreprocessingDataTable d = enumerator.Current;
                    AddDataTableToTableLayout(d, x, y);
                }
            }
        }
        // add variable to data table and item list
        private void AddVariable(string name)
        {
            DataRow row = Content.CreateDataRow(name, chartType);

            dataTable.Rows.Add(row);
            PreprocessingDataTable d = new PreprocessingDataTable(name);

            d.Rows.Add(row);
            dataTablePerVariable.Add(d);
            Content.VariableItemList.Add(new StringValue(name));
            if (!Content.AllInOneMode)
            {
                GenerateChart();
            }
        }
Esempio n. 6
0
        //Set variable item list from with variable from data table
        private void setVariableItemListFromDataTable(HistogramContent histoContent, PreprocessingDataTable dataTable)
        {
            // only one data row should be in data table
            if (dataTable.Rows.Count == 1)
            {
                string variableName = dataTable.Rows.ElementAt(0).Name;

                // set only variable name checked
                foreach (var checkedItem in histoContent.VariableItemList)
                {
                    if (checkedItem.Value == variableName)
                    {
                        histoContent.VariableItemList.SetItemCheckedState(checkedItem, true);
                    }
                    else
                    {
                        histoContent.VariableItemList.SetItemCheckedState(checkedItem, false);
                    }
                }
            }
        }
        private void AddDataTableToTableLayout(PreprocessingDataTable dataTable, int x, int y)
        {
            PreprocessingDataTableView dataView = new PreprocessingDataTableView();

            dataView.Classification             = Classification;
            dataView.IsDetailedChartViewEnabled = IsDetailedChartViewEnabled;

            if (dataTable == null)
            {
                // dummy panel for empty field
                Panel p = new Panel();
                p.Dock = DockStyle.Fill;
                tableLayoutPanel.Controls.Add(p, y, x);
            }
            else
            {
                dataView.Content = dataTable;
                dataView.Dock    = DockStyle.Fill;
                tableLayoutPanel.Controls.Add(dataView, y, x);
            }
        }
        //Variable selection changed
        //Add or remove data row
        private void CheckedItemsChanged(object sender, CollectionItemsChangedEventArgs <IndexedItem <StringValue> > checkedItems)
        {
            foreach (IndexedItem <StringValue> item in checkedItems.Items)
            {
                string variableName = item.Value.Value;

                //variable is displayed -> remove
                if (VariableIsDisplayed(variableName))
                {
                    dataTable.Rows.Remove(variableName);
                    dataTable.SelectedRows.Remove(variableName);
                    dataTablePerVariable.Remove(dataTablePerVariable.Find(x => (x.Name == variableName)));
                    //variable isnt't displayed -> add
                }
                else
                {
                    DataRow row         = GetDataRow(variableName);
                    DataRow selectedRow = GetSelectedDataRow(variableName);
                    dataTable.Rows.Add(row);

                    PreprocessingDataTable pdt = new PreprocessingDataTable(variableName);
                    pdt.Rows.Add(row);
                    dataTablePerVariable.Add(pdt);

                    //update selection
                    if (selectedRow != null)
                    {
                        dataTable.SelectedRows.Add(selectedRow);
                        pdt.SelectedRows.Add(selectedRow);
                    }
                }
            }

            // update chart if not in all in one mode
            if (Content != null && !Content.AllInOneMode)
            {
                GenerateChart();
            }
        }
        private void InitData()
        {
            if (Content.VariableItemList == null)
            {
                Content.VariableItemList = Content.CreateVariableItemList();
            }
            else
            {
                var checkedNames = Content.VariableItemList.CheckedItems.Select(x => x.Value.Value);
                Content.VariableItemList = Content.CreateVariableItemList(checkedNames);
            }
            checkedItemList.Content = Content.VariableItemList;

            //Create data tables and data rows
            dataRows             = Content.CreateAllDataRows(chartType);
            dataTable            = new PreprocessingDataTable(chartTitle);
            dataTablePerVariable = new List <PreprocessingDataTable>();

            //add data rows to data tables according to checked item list
            foreach (var checkedItem in Content.VariableItemList.CheckedItems)
            {
                string variableName      = Content.VariableItemList[checkedItem.Index].Value;
                PreprocessingDataTable d = new PreprocessingDataTable(variableName);
                DataRow row = GetDataRow(variableName);

                if (row != null)
                {
                    //add row to data table
                    dataTable.Rows.Add(row);

                    //add row to data table per variable
                    d.Rows.Add(row);
                    dataTablePerVariable.Add(d);
                }
            }

            UpdateSelection();
        }
Esempio n. 10
0
    private void AddDataTableToTableLayout(PreprocessingDataTable dataTable, int x, int y) {
      PreprocessingDataTableView dataView = new PreprocessingDataTableView();
      dataView.Classification = Classification;
      dataView.IsDetailedChartViewEnabled = IsDetailedChartViewEnabled;

      if (dataTable == null) {
        // dummy panel for empty field 
        Panel p = new Panel();
        p.Dock = DockStyle.Fill;
        tableLayoutPanel.Controls.Add(p, y, x);
      } else {
        dataView.Content = dataTable;
        dataView.Dock = DockStyle.Fill;
        tableLayoutPanel.Controls.Add(dataView, y, x);
      }
    }
Esempio n. 11
0
 // add variable to data table and item list
 private void AddVariable(string name) {
   DataRow row = Content.CreateDataRow(name, chartType);
   dataTable.Rows.Add(row);
   PreprocessingDataTable d = new PreprocessingDataTable(name);
   d.Rows.Add(row);
   dataTablePerVariable.Add(d);
   Content.VariableItemList.Add(new StringValue(name));
   if (!Content.AllInOneMode)
     GenerateChart();
 }
Esempio n. 12
0
    private void InitData() {
      if (Content.VariableItemList == null) {
        Content.VariableItemList = Content.CreateVariableItemList();
      } else {
        var checkedNames = Content.VariableItemList.CheckedItems.Select(x => x.Value.Value);
        Content.VariableItemList = Content.CreateVariableItemList(checkedNames);
      }
      checkedItemList.Content = Content.VariableItemList;

      //Create data tables and data rows
      dataRows = Content.CreateAllDataRows(chartType);
      dataTable = new PreprocessingDataTable(chartTitle);
      dataTablePerVariable = new List<PreprocessingDataTable>();

      //add data rows to data tables according to checked item list
      foreach (var checkedItem in Content.VariableItemList.CheckedItems) {
        string variableName = Content.VariableItemList[checkedItem.Index].Value;
        PreprocessingDataTable d = new PreprocessingDataTable(variableName);
        DataRow row = GetDataRow(variableName);

        if (row != null) {
          //add row to data table
          dataTable.Rows.Add(row);

          //add row to data table per variable
          d.Rows.Add(row);
          dataTablePerVariable.Add(d);
        }
      }

      UpdateSelection();
    }
Esempio n. 13
0
    private void addChartsToTableLayoutPanel() {

      List<string> variables = Content.PreprocessingData.GetDoubleVariableNames().ToList();

      //set scatter plots and histograms
      for (int x = 1; x < variables.Count + 1; x++) {

        for (int y = 1; y < variables.Count + 1; y++) {
          // use historgram if x and y variable are equal
          if (x == y) {
            PreprocessingDataTable dataTable = new PreprocessingDataTable();
            DataRow dataRow = Content.CreateDataRow(variables[x - 1], DataRowVisualProperties.DataRowChartType.Histogram);
            dataTable.Rows.Add(dataRow);
            PreprocessingDataTableView pcv = new PreprocessingDataTableView();
            pcv.ChartDoubleClick += HistogramDoubleClick;
            pcv.Content = dataTable;
            tableLayoutPanel.Controls.Add(pcv, y, x);
          }
          //scatter plot
          else {
            ScatterPlot scatterPlot = Content.CreateScatterPlot(variables[x - 1], variables[y - 1]);
            PreprocessingScatterPlotView pspv = new PreprocessingScatterPlotView();
            pspv.ChartDoubleClick += ScatterPlotDoubleClick;
            pspv.Content = scatterPlot;
            pspv.Dock = DockStyle.Fill;
            tableLayoutPanel.Controls.Add(pspv, x, y);
          }
        }
      }
    }
Esempio n. 14
0
    //Set variable item list from with variable from data table
    private void setVariableItemListFromDataTable(HistogramContent histoContent, PreprocessingDataTable dataTable) {

      // only one data row should be in data table 
      if (dataTable.Rows.Count == 1) {
        string variableName = dataTable.Rows.ElementAt(0).Name;

        // set only variable name checked
        foreach (var checkedItem in histoContent.VariableItemList) {
          if (checkedItem.Value == variableName)
            histoContent.VariableItemList.SetItemCheckedState(checkedItem, true);
          else
            histoContent.VariableItemList.SetItemCheckedState(checkedItem, false);

        }
      }
    }