Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14975


Ignore:
Timestamp:
05/12/17 13:41:46 (7 years ago)
Author:
pfleck
Message:

#2709

  • Improved Check/Uncheck of variables.
    • Instead of removing whole columns/rows from the tablelayout, the tablelayout stays the same with the column/rows width/height set to zero.
    • Hidden charts are not updated to avoid unnessecary calculations.
  • Added a check (messagebox) if >20 variables should be displayed in the multi scatterplot or reduced to 20.
  • Added configuration for point size/opacity and (histogram)aggregation.
Location:
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingChartView.cs

    r14902 r14975  
    3939    protected Dictionary<string, DataTableControl> dataTableControls;
    4040
    41     protected static readonly Color[] Colors = {
     41    public static readonly Color[] Colors = {
    4242      Color.FromArgb(59, 136, 239), Color.FromArgb(252, 177, 59), Color.FromArgb(226, 64, 10),
    4343      Color.FromArgb(5, 100, 146), Color.FromArgb(191, 191, 191), Color.FromArgb(26, 59, 105),
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingCheckedVariablesView.Designer.cs

    r14917 r14975  
    9494      this.uncheckAllButton.Name = "uncheckAllButton";
    9595      this.uncheckAllButton.Size = new System.Drawing.Size(24, 24);
    96       this.uncheckAllButton.TabIndex = 7;
     96      this.uncheckAllButton.TabIndex = 9;
    9797      this.toolTip.SetToolTip(this.uncheckAllButton, "None");
    9898      this.uncheckAllButton.UseVisualStyleBackColor = true;
     
    116116      this.checkInputsTargetButton.Name = "checkInputsTargetButton";
    117117      this.checkInputsTargetButton.Size = new System.Drawing.Size(24, 24);
    118       this.checkInputsTargetButton.TabIndex = 7;
     118      this.checkInputsTargetButton.TabIndex = 8;
    119119      this.toolTip.SetToolTip(this.checkInputsTargetButton, "Inputs & Target");
    120120      this.checkInputsTargetButton.UseVisualStyleBackColor = true;
     
    134134      this.variablesListView.Name = "variablesListView";
    135135      this.variablesListView.Size = new System.Drawing.Size(168, 348);
    136       this.variablesListView.TabIndex = 6;
     136      this.variablesListView.TabIndex = 12;
    137137      this.variablesListView.UseCompatibleStateImageBehavior = false;
    138138      this.variablesListView.View = System.Windows.Forms.View.Details;
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.Designer.cs

    r14917 r14975  
    5858      this.widthLabel = new System.Windows.Forms.Label();
    5959      this.lockAspectCheckBox = new System.Windows.Forms.CheckBox();
     60      this.pointSizeNumericUpDown = new System.Windows.Forms.NumericUpDown();
     61      this.pointSizeLabel = new System.Windows.Forms.Label();
    6062      this.regressionGroupBox = new System.Windows.Forms.GroupBox();
    6163      this.regressionTypeComboBox = new System.Windows.Forms.ComboBox();
     
    6466      this.label4 = new System.Windows.Forms.Label();
    6567      this.groupingOptionsBox = new System.Windows.Forms.GroupBox();
     68      this.aggregationLabel = new System.Windows.Forms.Label();
     69      this.aggregationComboBox = new System.Windows.Forms.ComboBox();
    6670      this.groupingComboBox = new System.Windows.Forms.ComboBox();
     71      this.label1 = new System.Windows.Forms.Label();
     72      this.pointOpacityNumericUpDown = new System.Windows.Forms.NumericUpDown();
     73      this.pointsGroupBox = new System.Windows.Forms.GroupBox();
    6774      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
    6875      this.splitContainer.Panel1.SuspendLayout();
     
    7683      ((System.ComponentModel.ISupportInitialize)(this.heightNumericUpDown)).BeginInit();
    7784      ((System.ComponentModel.ISupportInitialize)(this.widthNumericUpDown)).BeginInit();
     85      ((System.ComponentModel.ISupportInitialize)(this.pointSizeNumericUpDown)).BeginInit();
    7886      this.regressionGroupBox.SuspendLayout();
    7987      ((System.ComponentModel.ISupportInitialize)(this.polynomialRegressionOrderNumericUpDown)).BeginInit();
    8088      this.groupingOptionsBox.SuspendLayout();
     89      ((System.ComponentModel.ISupportInitialize)(this.pointOpacityNumericUpDown)).BeginInit();
     90      this.pointsGroupBox.SuspendLayout();
    8191      this.SuspendLayout();
    8292      //
     
    8797      //
    8898      this.splitContainer.Panel1.Controls.Add(this.sizeGroupBox);
     99      this.splitContainer.Panel1.Controls.Add(this.pointsGroupBox);
    89100      this.splitContainer.Panel1.Controls.Add(this.groupingOptionsBox);
    90101      this.splitContainer.Panel1.Controls.Add(this.regressionGroupBox);
     
    201212      this.sizeGroupBox.Controls.Add(this.lockAspectCheckBox);
    202213      this.sizeGroupBox.Dock = System.Windows.Forms.DockStyle.Bottom;
    203       this.sizeGroupBox.Location = new System.Drawing.Point(0, 179);
     214      this.sizeGroupBox.Location = new System.Drawing.Point(0, 78);
    204215      this.sizeGroupBox.Name = "sizeGroupBox";
    205       this.sizeGroupBox.Size = new System.Drawing.Size(180, 95);
     216      this.sizeGroupBox.Size = new System.Drawing.Size(180, 94);
    206217      this.sizeGroupBox.TabIndex = 5;
    207218      this.sizeGroupBox.TabStop = false;
     
    210221      // heightNumericUpDown
    211222      //
    212       this.heightNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     223      this.heightNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    213224            | System.Windows.Forms.AnchorStyles.Right)));
    214225      this.heightNumericUpDown.Increment = new decimal(new int[] {
     
    235246      // widthNumericUpDown
    236247      //
    237       this.widthNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     248      this.widthNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    238249            | System.Windows.Forms.AnchorStyles.Right)));
    239250      this.widthNumericUpDown.Increment = new decimal(new int[] {
     
    288299      this.lockAspectCheckBox.UseVisualStyleBackColor = true;
    289300      //
     301      // pointSizeNumericUpDown
     302      //
     303      this.pointSizeNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     304            | System.Windows.Forms.AnchorStyles.Right)));
     305      this.pointSizeNumericUpDown.Location = new System.Drawing.Point(58, 15);
     306      this.pointSizeNumericUpDown.Maximum = new decimal(new int[] {
     307            50,
     308            0,
     309            0,
     310            0});
     311      this.pointSizeNumericUpDown.Minimum = new decimal(new int[] {
     312            1,
     313            0,
     314            0,
     315            0});
     316      this.pointSizeNumericUpDown.Name = "pointSizeNumericUpDown";
     317      this.pointSizeNumericUpDown.Size = new System.Drawing.Size(116, 20);
     318      this.pointSizeNumericUpDown.TabIndex = 8;
     319      this.pointSizeNumericUpDown.Value = new decimal(new int[] {
     320            3,
     321            0,
     322            0,
     323            0});
     324      this.pointSizeNumericUpDown.ValueChanged += new System.EventHandler(this.pointSizeNumericUpDown_ValueChanged);
     325      //
     326      // pointSizeLabel
     327      //
     328      this.pointSizeLabel.AutoSize = true;
     329      this.pointSizeLabel.Location = new System.Drawing.Point(6, 17);
     330      this.pointSizeLabel.Name = "pointSizeLabel";
     331      this.pointSizeLabel.Size = new System.Drawing.Size(30, 13);
     332      this.pointSizeLabel.TabIndex = 7;
     333      this.pointSizeLabel.Text = "Size:";
     334      //
    290335      // regressionGroupBox
    291336      //
     
    295340      this.regressionGroupBox.Controls.Add(this.label4);
    296341      this.regressionGroupBox.Dock = System.Windows.Forms.DockStyle.Bottom;
    297       this.regressionGroupBox.Location = new System.Drawing.Point(0, 324);
     342      this.regressionGroupBox.Location = new System.Drawing.Point(0, 322);
    298343      this.regressionGroupBox.Name = "regressionGroupBox";
    299       this.regressionGroupBox.Size = new System.Drawing.Size(180, 79);
     344      this.regressionGroupBox.Size = new System.Drawing.Size(180, 81);
    300345      this.regressionGroupBox.TabIndex = 3;
    301346      this.regressionGroupBox.TabStop = false;
     
    304349      // regressionTypeComboBox
    305350      //
    306       this.regressionTypeComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     351      this.regressionTypeComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    307352            | System.Windows.Forms.AnchorStyles.Right)));
    308353      this.regressionTypeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     
    316361      // polynomialRegressionOrderNumericUpDown
    317362      //
    318       this.polynomialRegressionOrderNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     363      this.polynomialRegressionOrderNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    319364            | System.Windows.Forms.AnchorStyles.Right)));
    320365      this.polynomialRegressionOrderNumericUpDown.Location = new System.Drawing.Point(67, 45);
     
    360405      // groupingOptionsBox
    361406      //
     407      this.groupingOptionsBox.Controls.Add(this.aggregationLabel);
     408      this.groupingOptionsBox.Controls.Add(this.aggregationComboBox);
    362409      this.groupingOptionsBox.Controls.Add(this.groupingComboBox);
    363410      this.groupingOptionsBox.Dock = System.Windows.Forms.DockStyle.Bottom;
    364       this.groupingOptionsBox.Location = new System.Drawing.Point(0, 274);
     411      this.groupingOptionsBox.Location = new System.Drawing.Point(0, 241);
    365412      this.groupingOptionsBox.Name = "groupingOptionsBox";
    366       this.groupingOptionsBox.Size = new System.Drawing.Size(180, 50);
     413      this.groupingOptionsBox.Size = new System.Drawing.Size(180, 81);
    367414      this.groupingOptionsBox.TabIndex = 8;
    368415      this.groupingOptionsBox.TabStop = false;
    369       this.groupingOptionsBox.Text = "Grouping Variable";
     416      this.groupingOptionsBox.Text = "Grouping";
     417      //
     418      // aggregationLabel
     419      //
     420      this.aggregationLabel.AutoSize = true;
     421      this.aggregationLabel.Location = new System.Drawing.Point(6, 49);
     422      this.aggregationLabel.Name = "aggregationLabel";
     423      this.aggregationLabel.Size = new System.Drawing.Size(67, 13);
     424      this.aggregationLabel.TabIndex = 3;
     425      this.aggregationLabel.Text = "Aggregation:";
     426      //
     427      // aggregationComboBox
     428      //
     429      this.aggregationComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     430            | System.Windows.Forms.AnchorStyles.Right)));
     431      this.aggregationComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     432      this.aggregationComboBox.Enabled = false;
     433      this.aggregationComboBox.FormattingEnabled = true;
     434      this.aggregationComboBox.Location = new System.Drawing.Point(79, 46);
     435      this.aggregationComboBox.Name = "aggregationComboBox";
     436      this.aggregationComboBox.Size = new System.Drawing.Size(96, 21);
     437      this.aggregationComboBox.TabIndex = 2;
     438      this.aggregationComboBox.SelectedIndexChanged += new System.EventHandler(this.aggregationComboBox_SelectedIndexChanged);
    370439      //
    371440      // groupingComboBox
    372441      //
    373       this.groupingComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     442      this.groupingComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    374443            | System.Windows.Forms.AnchorStyles.Right)));
    375444      this.groupingComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     
    380449      this.groupingComboBox.TabIndex = 1;
    381450      this.groupingComboBox.SelectedIndexChanged += new System.EventHandler(this.groupingComboBox_SelectedIndexChanged);
     451      //
     452      // label1
     453      //
     454      this.label1.AutoSize = true;
     455      this.label1.Location = new System.Drawing.Point(6, 43);
     456      this.label1.Name = "label1";
     457      this.label1.Size = new System.Drawing.Size(46, 13);
     458      this.label1.TabIndex = 7;
     459      this.label1.Text = "Opacity:";
     460      //
     461      // pointOpacityNumericUpDown
     462      //
     463      this.pointOpacityNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     464            | System.Windows.Forms.AnchorStyles.Right)));
     465      this.pointOpacityNumericUpDown.DecimalPlaces = 2;
     466      this.pointOpacityNumericUpDown.Increment = new decimal(new int[] {
     467            1,
     468            0,
     469            0,
     470            65536});
     471      this.pointOpacityNumericUpDown.Location = new System.Drawing.Point(58, 41);
     472      this.pointOpacityNumericUpDown.Maximum = new decimal(new int[] {
     473            1,
     474            0,
     475            0,
     476            0});
     477      this.pointOpacityNumericUpDown.Name = "pointOpacityNumericUpDown";
     478      this.pointOpacityNumericUpDown.Size = new System.Drawing.Size(115, 20);
     479      this.pointOpacityNumericUpDown.TabIndex = 8;
     480      this.pointOpacityNumericUpDown.Value = new decimal(new int[] {
     481            1,
     482            0,
     483            0,
     484            0});
     485      this.pointOpacityNumericUpDown.ValueChanged += new System.EventHandler(this.pointOpacityNumericUpDown_ValueChanged);
     486      //
     487      // pointsGroupBox
     488      //
     489      this.pointsGroupBox.Controls.Add(this.pointOpacityNumericUpDown);
     490      this.pointsGroupBox.Controls.Add(this.pointSizeLabel);
     491      this.pointsGroupBox.Controls.Add(this.pointSizeNumericUpDown);
     492      this.pointsGroupBox.Controls.Add(this.label1);
     493      this.pointsGroupBox.Dock = System.Windows.Forms.DockStyle.Bottom;
     494      this.pointsGroupBox.Location = new System.Drawing.Point(0, 172);
     495      this.pointsGroupBox.Name = "pointsGroupBox";
     496      this.pointsGroupBox.Size = new System.Drawing.Size(180, 69);
     497      this.pointsGroupBox.TabIndex = 4;
     498      this.pointsGroupBox.TabStop = false;
     499      this.pointsGroupBox.Text = "Points";
    382500      //
    383501      // ScatterPlotMultiView
     
    401519      ((System.ComponentModel.ISupportInitialize)(this.heightNumericUpDown)).EndInit();
    402520      ((System.ComponentModel.ISupportInitialize)(this.widthNumericUpDown)).EndInit();
     521      ((System.ComponentModel.ISupportInitialize)(this.pointSizeNumericUpDown)).EndInit();
    403522      this.regressionGroupBox.ResumeLayout(false);
    404523      this.regressionGroupBox.PerformLayout();
    405524      ((System.ComponentModel.ISupportInitialize)(this.polynomialRegressionOrderNumericUpDown)).EndInit();
    406525      this.groupingOptionsBox.ResumeLayout(false);
     526      this.groupingOptionsBox.PerformLayout();
     527      ((System.ComponentModel.ISupportInitialize)(this.pointOpacityNumericUpDown)).EndInit();
     528      this.pointsGroupBox.ResumeLayout(false);
     529      this.pointsGroupBox.PerformLayout();
    407530      this.ResumeLayout(false);
    408531
     
    431554    private System.Windows.Forms.NumericUpDown heightNumericUpDown;
    432555    private System.Windows.Forms.CheckBox lockAspectCheckBox;
     556    private System.Windows.Forms.NumericUpDown pointSizeNumericUpDown;
     557    private System.Windows.Forms.Label pointSizeLabel;
     558    private System.Windows.Forms.Label aggregationLabel;
     559    private System.Windows.Forms.ComboBox aggregationComboBox;
     560    private System.Windows.Forms.GroupBox pointsGroupBox;
     561    private System.Windows.Forms.NumericUpDown pointOpacityNumericUpDown;
     562    private System.Windows.Forms.Label label1;
    433563  }
    434564}
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.cs

    r14953 r14975  
    3131using HeuristicLab.MainForm;
    3232using HeuristicLab.MainForm.WindowsForms;
     33using AggregationType = HeuristicLab.Analysis.DataRowVisualProperties.DataRowHistogramAggregation;
    3334using RegressionType = HeuristicLab.Analysis.ScatterPlotDataRowVisualProperties.ScatterPlotDataRowRegressionType;
    3435
     
    5051      regressionTypeComboBox.SelectedItem = RegressionType.None;
    5152
     53      aggregationComboBox.DataSource = Enum.GetValues(typeof(AggregationType));
     54      aggregationComboBox.SelectedItem = AggregationType.Overlapping;
     55
    5256      #region Initialize Scrollbars
    5357      columnHeaderScrollPanel.HorizontalScroll.Enabled = true;
     
    8589        groupingComboBox.SelectedItem = Content.GroupingVariable;
    8690
     91        // uncheck variables that max 20 vars are selected initially
     92        var list = Content.VariableItemList;
     93        int numChecked = list.CheckedItems.Count();
     94        if (numChecked > 20) {
     95          string message = string.Format("Displaying {0} variables ({1} charts) can cause HeuristicLab to become instable. " +
     96                                         "Should the number of initially checked variables be reduced to 20?",
     97            numChecked, numChecked * numChecked);
     98          if (MessageBox.Show(this, message, "Reduce befor continue?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) {
     99            suppressCheckedChangedUpdate = true;
     100            foreach (var var in list.CheckedItems.Reverse().Take(numChecked - 20)) {
     101              Content.VariableItemList.SetItemCheckedState(var.Value, false);
     102            }
     103            suppressCheckedChangedUpdate = false;
     104          }
     105        }
    87106        GenerateCharts(true);
    88107      }
     
    93112      var regressionType = (RegressionType)regressionTypeComboBox.SelectedValue;
    94113      polynomialRegressionOrderNumericUpDown.Enabled = regressionType == RegressionType.Polynomial;
     114      sizeGroupBox.Enabled = Content != null;
     115      pointsGroupBox.Enabled = Content != null;
     116      groupingComboBox.Enabled = Content != null;
     117      regressionGroupBox.Enabled = Content != null;
    95118    }
    96119
    97120    protected override void CheckedItemsChanged(object sender, CollectionItemsChangedEventArgs<IndexedItem<StringValue>> checkedItems) {
    98121      base.CheckedItemsChanged(sender, checkedItems);
    99       if (suppressCheckedChangedUpdate)
    100         return;
    101       foreach (var variable in checkedItems.Items.Select(i => i.Value.Value)) {
    102         if (IsVariableChecked(variable))
    103           AddChartToTable(variable);
     122      if (suppressCheckedChangedUpdate) return;
     123
     124      foreach (var variable in checkedItems.Items) {
     125        if (Content.VariableItemList.ItemChecked(variable.Value))
     126          ShowChartOnTable(variable.Value.Value, variable.Index);
    104127        else
    105           RemoveChartFromTable(variable);
    106       }
    107     }
    108 
    109     #region Add and remove charts
     128          HideChartFromTable(variable.Value.Value, variable.Index);
     129      }
     130    }
     131
     132    #region Show and Hide charts
     133    private void ShowChartOnTable(string variable, int idx) {
     134      frameTableLayoutPanel.SuspendLayout();
     135
     136      // show column header
     137      var colH = columnHeaderTableLayoutPanel;
     138      colH.ColumnStyles[idx].Width = GetColumnWidth();
     139      if (colH.GetControlFromPosition(idx, 0) == null)
     140        colH.Controls.Add(GetColumnHeader(variable), idx, 0);
     141      else
     142        colH.GetControlFromPosition(idx, 0).Visible = true;
     143
     144      // show row header
     145      var rowH = rowHeaderTableLayoutPanel;
     146      rowH.RowStyles[idx].Height = GetRowHeight();
     147      if (rowH.GetControlFromPosition(0, idx) == null)
     148        rowH.Controls.Add(GetRowHeader(variable), 0, idx);
     149      else
     150        rowH.GetControlFromPosition(0, idx).Visible = true;
     151
     152      // show body
     153      var body = bodyTableLayoutPanel;
     154      ShowColumnHelper(body, idx, r => GetBody(variable, Content.VariableItemList[r].Value));
     155      ShowRowHelper(body, idx, c => GetBody(Content.VariableItemList[c].Value, variable));
     156
     157      frameTableLayoutPanel.ResumeLayout(true);
     158    }
     159    private void ShowColumnHelper(TableLayoutPanel tlp, int idx, Func<int, Control> creatorFunc) {
     160      tlp.ColumnStyles[idx].Width = GetColumnWidth();
     161      for (int r = 0; r < tlp.RowCount; r++) {
     162        if (Content.VariableItemList.ItemChecked(Content.VariableItemList[r])) {
     163          var control = tlp.GetControlFromPosition(idx, r);
     164          if (control == null)
     165            tlp.Controls.Add(creatorFunc(r), idx, r);
     166          else
     167            control.Visible = true;
     168        }
     169      }
     170    }
     171    private void ShowRowHelper(TableLayoutPanel tlp, int idx, Func<int, Control> creatorFunc) {
     172      tlp.RowStyles[idx].Height = GetRowHeight();
     173      for (int c = 0; c < tlp.ColumnCount; c++) {
     174        if (Content.VariableItemList.ItemChecked(Content.VariableItemList[c])) {
     175          var control = tlp.GetControlFromPosition(c, idx);
     176          if (control == null)
     177            tlp.Controls.Add(creatorFunc(c), c, idx);
     178          else
     179            tlp.GetControlFromPosition(c, idx).Visible = true;
     180        }
     181      }
     182    }
     183
     184    private void HideChartFromTable(string variable, int idx) {
     185      frameTableLayoutPanel.SuspendLayout();
     186
     187      // hide column header
     188      var colH = columnHeaderTableLayoutPanel;
     189      HideColumnHelper(colH, idx);
     190
     191      // hide row header
     192      var rowH = rowHeaderTableLayoutPanel;
     193      HideRowHelper(rowH, idx);
     194
     195      // hide from body
     196      var body = bodyTableLayoutPanel;
     197      HideColumnHelper(body, idx);
     198      HideRowHelper(body, idx);
     199
     200      frameTableLayoutPanel.ResumeLayout(true);
     201    }
     202    private void HideColumnHelper(TableLayoutPanel tlp, int idx) {
     203      tlp.ColumnStyles[idx].Width = 0;
     204      // hide controls
     205      for (int r = 0; r < tlp.RowCount; r++) {
     206        //tlp.Controls.Remove(tlp.GetControlFromPosition(idx, r));
     207        var control = tlp.GetControlFromPosition(idx, r);
     208        if (control != null)
     209          control.Visible = false;
     210      }
     211    }
     212    private void HideRowHelper(TableLayoutPanel tlp, int idx) {
     213      tlp.RowStyles[idx].Height = 0;
     214      // hide controls
     215      for (int c = 0; c < tlp.ColumnCount; c++) {
     216        //tlp.Controls.Remove(tlp.GetControlFromPosition(c, idx));
     217        var control = tlp.GetControlFromPosition(c, idx);
     218        if (control != null)
     219          control.Visible = false;
     220      }
     221    }
     222    #endregion
     223
     224    #region Add/Remove/Update Variable
     225    protected override void AddVariable(string name) {
     226      base.AddVariable(name);
     227      if (IsVariableChecked(name))
     228        AddChartToTable(name);
     229    }
     230    protected override void RemoveVariable(string name) {
     231      base.RemoveVariable(name);
     232
     233      if (IsVariableChecked(name)) {
     234        RemoveChartFromTable(name);
     235      }
     236
     237      // clear caches
     238      columnHeaderCache[name].Dispose();
     239      columnHeaderCache.Remove(name);
     240      rowHeaderCache[name].Dispose();
     241      rowHeaderCache.Remove(name);
     242      var keys = bodyCache.Keys.Where(t => t.Item1 == name || t.Item2 == name).ToList();
     243      foreach (var key in keys) {
     244        bodyCache[key].Dispose();
     245        bodyCache.Remove(key);
     246      }
     247    }
     248    protected override void UpdateVariable(string name) {
     249      base.UpdateVariable(name);
     250      RemoveVariable(name);
     251      AddVariable(name);
     252    }
     253    protected override void ResetAllVariables() {
     254      GenerateCharts(true);
     255    }
     256
    110257    private void AddChartToTable(string variable) {
    111258      frameTableLayoutPanel.SuspendLayout();
     
    226373      tlp.RowStyles.RemoveAt(tlp.RowCount - 1);
    227374      tlp.RowCount--;
    228     }
    229     #endregion
    230 
    231     #region Add/Remove/Update Variable
    232     protected override void AddVariable(string name) {
    233       base.AddVariable(name);
    234       if (IsVariableChecked(name))
    235         AddChartToTable(name);
    236     }
    237     protected override void RemoveVariable(string name) {
    238       base.RemoveVariable(name);
    239 
    240       // clear caches
    241       columnHeaderCache[name].Dispose();
    242       columnHeaderCache.Remove(name);
    243       rowHeaderCache[name].Dispose();
    244       rowHeaderCache.Remove(name);
    245       var keys = bodyCache.Keys.Where(t => t.Item1 == name || t.Item2 == name).ToList();
    246       foreach (var key in keys) {
    247         bodyCache[key].Dispose();
    248         bodyCache.Remove(key);
    249       }
    250 
    251       if (IsVariableChecked(name)) {
    252         RemoveChartFromTable(name);
    253       }
    254     }
    255     protected override void UpdateVariable(string name) {
    256       base.UpdateVariable(name);
    257       RemoveVariable(name);
    258       AddVariable(name);
    259     }
    260     protected override void ResetAllVariables() {
    261       GenerateCharts(true);
    262375    }
    263376    #endregion
     
    295408      if (!bodyCache.ContainsKey(key)) {
    296409        if (rowVariable == colVariable) { // use historgram if x and y variable are equal
    297           var dataTable = HistogramContent.CreateHistogram(Content.PreprocessingData, rowVariable, (string)groupingComboBox.SelectedItem, DataRowVisualProperties.DataRowHistogramAggregation.Overlapping);
     410          var dataTable = HistogramContent.CreateHistogram(
     411            Content.PreprocessingData,
     412            rowVariable,
     413            (string)groupingComboBox.SelectedItem,
     414            (AggregationType)aggregationComboBox.SelectedItem);
     415          dataTable.VisualProperties.Title = string.Empty;
    298416          foreach (var dataRow in dataTable.Rows)
    299             dataRow.VisualProperties.IsVisibleInLegend = false;
    300 
     417            dataRow.VisualProperties.IsVisibleInLegend = groupingComboBox.SelectedIndex > 0;
    301418          var pcv = new DataTableControl {
    302419            Name = key.ToString(),
     
    309426          bodyCache.Add(key, pcv);
    310427        } else { //scatter plot
    311           var scatterPlot = ScatterPlotContent.CreateScatterPlot(Content.PreprocessingData, colVariable, rowVariable, (string)groupingComboBox.SelectedItem);
     428          var scatterPlot = ScatterPlotContent.CreateScatterPlot(Content.PreprocessingData,
     429            colVariable,
     430            rowVariable,
     431            (string)groupingComboBox.SelectedItem);
    312432          var regressionType = (RegressionType)regressionTypeComboBox.SelectedValue;
    313433          int order = (int)polynomialRegressionOrderNumericUpDown.Value;
     434          int i = 0;
     435          var colors = PreprocessingChartView.Colors;
    314436          foreach (var row in scatterPlot.Rows) {
    315             row.VisualProperties.PointSize = 3;
     437            row.VisualProperties.PointSize = (int)pointSizeNumericUpDown.Value;
     438            row.VisualProperties.Color = Color.FromArgb((int)(pointOpacityNumericUpDown.Value * 255),
     439              row.VisualProperties.Color.IsEmpty ? colors[i++ % colors.Length] : row.VisualProperties.Color);
     440            //row.VisualProperties.IsVisibleInLegend = true;
    316441            row.VisualProperties.IsRegressionVisibleInLegend = false;
    317442            row.VisualProperties.RegressionType = regressionType;
     
    342467      if (suppressCheckedChangedUpdate) return;
    343468
    344       var variables = GetCheckedVariables();
    345 
    346469      // Clear old layouts and cache
    347470      foreach (var tableLayoutPanel in new[] { columnHeaderTableLayoutPanel, rowHeaderTableLayoutPanel, bodyTableLayoutPanel }) {
     
    362485      }
    363486
     487      var variables = Content.VariableItemList.Select(x => x.Value).ToList();
     488
    364489      // Set row and column count
    365490      columnHeaderTableLayoutPanel.ColumnCount = variables.Count;
     
    370495      // Set column and row layout
    371496      for (int i = 0; i < variables.Count; i++) {
    372         columnHeaderTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, GetColumnWidth()));
    373         rowHeaderTableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, GetRowHeight()));
    374         bodyTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, GetColumnWidth()));
    375         bodyTableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, GetRowHeight()));
     497        bool @checked = Content.VariableItemList.ItemChecked(Content.VariableItemList[i]);
     498        columnHeaderTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, @checked ? GetColumnWidth() : 0));
     499        rowHeaderTableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, @checked ? GetRowHeight() : 0));
     500        bodyTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, @checked ? GetColumnWidth() : 0));
     501        bodyTableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, @checked ? GetRowHeight() : 0));
    376502      }
    377503
     
    384510
    385511    private void AddHeaderToTableLayoutPanels() {
    386       int i = 0;
    387       foreach (var variable in GetCheckedVariables()) {
    388         columnHeaderTableLayoutPanel.Controls.Add(GetColumnHeader(variable), i, 0);
    389         rowHeaderTableLayoutPanel.Controls.Add(GetRowHeader(variable), 0, i);
    390         i++;
     512      for (int i = 0; i < Content.VariableItemList.Count; i++) {
     513        var variable = Content.VariableItemList[i];
     514        if (Content.VariableItemList.ItemChecked(variable)) {
     515          columnHeaderTableLayoutPanel.Controls.Add(GetColumnHeader(variable.Value), i, 0);
     516          rowHeaderTableLayoutPanel.Controls.Add(GetRowHeader(variable.Value), 0, i);
     517        }
    391518      }
    392519    }
    393520    private void AddChartsToTableLayoutPanel() {
    394       int c = 0;
    395       foreach (var colVar in GetCheckedVariables()) {
     521      for (int c = 0; c < Content.VariableItemList.Count; c++) {
     522        var colVar = Content.VariableItemList[c].Value;
    396523        if (!IsVariableChecked(colVar)) continue;
    397         int r = 0;
    398         foreach (var rowVar in GetCheckedVariables()) {
     524        for (int r = 0; r < Content.VariableItemList.Count; r++) {
     525          var rowVar = Content.VariableItemList[r].Value;
    399526          if (!IsVariableChecked(rowVar)) continue;
    400527          bodyTableLayoutPanel.Controls.Add(GetBody(colVar, rowVar), c, r);
    401           r++;
    402         }
    403         c++;
     528        }
    404529      }
    405530      UpdateRegressionLine();
     
    429554      DataTableControl pcv = (DataTableControl)sender;
    430555      HistogramContent histoContent = new HistogramContent(Content.PreprocessingData);  // create new content     
    431       //ToDo: histoContent.VariableItemList = Content.CreateVariableItemList();
     556                                                                                        //ToDo: histoContent.VariableItemList = Content.CreateVariableItemList();
    432557      var dataTable = pcv.Content;
    433558
     
    501626      }
    502627      for (int i = 0; i < columnHeaderTableLayoutPanel.ColumnCount; i++) {
    503         columnHeaderTableLayoutPanel.ColumnStyles[i].Width = GetColumnWidth();
    504         bodyTableLayoutPanel.ColumnStyles[i].Width = GetColumnWidth();
     628        if (Content.VariableItemList.ItemChecked(Content.VariableItemList[i])) {
     629          columnHeaderTableLayoutPanel.ColumnStyles[i].Width = GetColumnWidth();
     630          bodyTableLayoutPanel.ColumnStyles[i].Width = GetColumnWidth();
     631        }
    505632      }
    506633      oldWidth = GetColumnWidth();
     
    516643      }
    517644      for (int i = 0; i < rowHeaderTableLayoutPanel.RowCount; i++) {
    518         rowHeaderTableLayoutPanel.RowStyles[i].Height = GetRowHeight();
    519         bodyTableLayoutPanel.RowStyles[i].Height = GetRowHeight();
     645        if (Content.VariableItemList.ItemChecked(Content.VariableItemList[i])) {
     646          rowHeaderTableLayoutPanel.RowStyles[i].Height = GetRowHeight();
     647          bodyTableLayoutPanel.RowStyles[i].Height = GetRowHeight();
     648        }
    520649      }
    521650      oldWidth = GetColumnWidth();
    522651      oldHeight = GetRowHeight();
    523652      frameTableLayoutPanel.ResumeRepaint(true);
     653    }
     654    private void pointSizeNumericUpDown_ValueChanged(object sender, EventArgs e) {
     655      int pointSize = (int)pointSizeNumericUpDown.Value;
     656      foreach (var control in bodyCache.ToList()) {
     657        var scatterPlotControl = control.Value as ScatterPlotControl;
     658        if (scatterPlotControl != null) {
     659          foreach (var row in scatterPlotControl.Content.Rows) {
     660            row.VisualProperties.PointSize = pointSize;
     661          }
     662        }
     663      }
     664    }
     665    private void pointOpacityNumericUpDown_ValueChanged(object sender, EventArgs e) {
     666      float opacity = (float)pointOpacityNumericUpDown.Value;
     667      foreach (var control in bodyCache.ToList()) {
     668        var scatterPlotControl = control.Value as ScatterPlotControl;
     669        if (scatterPlotControl != null) {
     670          foreach (var row in scatterPlotControl.Content.Rows) {
     671            var color = row.VisualProperties.Color;
     672            if (color.IsEmpty)
     673              color = PreprocessingChartView.Colors.First();
     674            row.VisualProperties.Color = Color.FromArgb((int)(opacity * 255), color);
     675          }
     676        }
     677      }
    524678    }
    525679    #endregion
     
    540694      int order = (int)polynomialRegressionOrderNumericUpDown.Value;
    541695
    542       foreach (var control in bodyCache.Values) {
    543         var scatterPlotControl = control as ScatterPlotControl;
     696      foreach (var control in bodyCache.ToList()) {
     697        // hidden chart => reset cache
     698        if (!bodyTableLayoutPanel.Controls.Contains(control.Value)) {
     699          bodyCache.Remove(control.Key);
     700        }
     701
     702        var scatterPlotControl = control.Value as ScatterPlotControl;
    544703        if (scatterPlotControl != null) {
    545704          foreach (var row in scatterPlotControl.Content.Rows) {
     
    553712    #endregion
    554713
     714    #region Grouping
    555715    private void groupingComboBox_SelectedIndexChanged(object sender, EventArgs e) {
     716      aggregationComboBox.Enabled = groupingComboBox.SelectedIndex > 0;
    556717      GenerateCharts(true); // new series within charts -> clear cache
    557718    }
     719
     720    private void aggregationComboBox_SelectedIndexChanged(object sender, EventArgs e) {
     721      var aggregation = (AggregationType)aggregationComboBox.SelectedValue;
     722      foreach (var control in bodyCache.ToList()) {
     723        // hidden chart => reset cache
     724        if (!bodyTableLayoutPanel.Controls.Contains(control.Value)) {
     725          bodyCache.Remove(control.Key);
     726        }
     727
     728        var histogramControl = control.Value as DataTableControl;
     729        if (histogramControl != null) {
     730          foreach (var row in histogramControl.Content.Rows) {
     731            row.VisualProperties.Aggregation = aggregation;
     732          }
     733        }
     734      }
     735    }
     736    #endregion
    558737  }
    559738}
Note: See TracChangeset for help on using the changeset viewer.