Changeset 14975
- Timestamp:
- 05/12/17 13:41:46 (8 years ago)
- 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 39 39 protected Dictionary<string, DataTableControl> dataTableControls; 40 40 41 p rotectedstatic readonly Color[] Colors = {41 public static readonly Color[] Colors = { 42 42 Color.FromArgb(59, 136, 239), Color.FromArgb(252, 177, 59), Color.FromArgb(226, 64, 10), 43 43 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 94 94 this.uncheckAllButton.Name = "uncheckAllButton"; 95 95 this.uncheckAllButton.Size = new System.Drawing.Size(24, 24); 96 this.uncheckAllButton.TabIndex = 7;96 this.uncheckAllButton.TabIndex = 9; 97 97 this.toolTip.SetToolTip(this.uncheckAllButton, "None"); 98 98 this.uncheckAllButton.UseVisualStyleBackColor = true; … … 116 116 this.checkInputsTargetButton.Name = "checkInputsTargetButton"; 117 117 this.checkInputsTargetButton.Size = new System.Drawing.Size(24, 24); 118 this.checkInputsTargetButton.TabIndex = 7;118 this.checkInputsTargetButton.TabIndex = 8; 119 119 this.toolTip.SetToolTip(this.checkInputsTargetButton, "Inputs & Target"); 120 120 this.checkInputsTargetButton.UseVisualStyleBackColor = true; … … 134 134 this.variablesListView.Name = "variablesListView"; 135 135 this.variablesListView.Size = new System.Drawing.Size(168, 348); 136 this.variablesListView.TabIndex = 6;136 this.variablesListView.TabIndex = 12; 137 137 this.variablesListView.UseCompatibleStateImageBehavior = false; 138 138 this.variablesListView.View = System.Windows.Forms.View.Details; -
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.Designer.cs
r14917 r14975 58 58 this.widthLabel = new System.Windows.Forms.Label(); 59 59 this.lockAspectCheckBox = new System.Windows.Forms.CheckBox(); 60 this.pointSizeNumericUpDown = new System.Windows.Forms.NumericUpDown(); 61 this.pointSizeLabel = new System.Windows.Forms.Label(); 60 62 this.regressionGroupBox = new System.Windows.Forms.GroupBox(); 61 63 this.regressionTypeComboBox = new System.Windows.Forms.ComboBox(); … … 64 66 this.label4 = new System.Windows.Forms.Label(); 65 67 this.groupingOptionsBox = new System.Windows.Forms.GroupBox(); 68 this.aggregationLabel = new System.Windows.Forms.Label(); 69 this.aggregationComboBox = new System.Windows.Forms.ComboBox(); 66 70 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(); 67 74 ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); 68 75 this.splitContainer.Panel1.SuspendLayout(); … … 76 83 ((System.ComponentModel.ISupportInitialize)(this.heightNumericUpDown)).BeginInit(); 77 84 ((System.ComponentModel.ISupportInitialize)(this.widthNumericUpDown)).BeginInit(); 85 ((System.ComponentModel.ISupportInitialize)(this.pointSizeNumericUpDown)).BeginInit(); 78 86 this.regressionGroupBox.SuspendLayout(); 79 87 ((System.ComponentModel.ISupportInitialize)(this.polynomialRegressionOrderNumericUpDown)).BeginInit(); 80 88 this.groupingOptionsBox.SuspendLayout(); 89 ((System.ComponentModel.ISupportInitialize)(this.pointOpacityNumericUpDown)).BeginInit(); 90 this.pointsGroupBox.SuspendLayout(); 81 91 this.SuspendLayout(); 82 92 // … … 87 97 // 88 98 this.splitContainer.Panel1.Controls.Add(this.sizeGroupBox); 99 this.splitContainer.Panel1.Controls.Add(this.pointsGroupBox); 89 100 this.splitContainer.Panel1.Controls.Add(this.groupingOptionsBox); 90 101 this.splitContainer.Panel1.Controls.Add(this.regressionGroupBox); … … 201 212 this.sizeGroupBox.Controls.Add(this.lockAspectCheckBox); 202 213 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); 204 215 this.sizeGroupBox.Name = "sizeGroupBox"; 205 this.sizeGroupBox.Size = new System.Drawing.Size(180, 9 5);216 this.sizeGroupBox.Size = new System.Drawing.Size(180, 94); 206 217 this.sizeGroupBox.TabIndex = 5; 207 218 this.sizeGroupBox.TabStop = false; … … 210 221 // heightNumericUpDown 211 222 // 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) 213 224 | System.Windows.Forms.AnchorStyles.Right))); 214 225 this.heightNumericUpDown.Increment = new decimal(new int[] { … … 235 246 // widthNumericUpDown 236 247 // 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) 238 249 | System.Windows.Forms.AnchorStyles.Right))); 239 250 this.widthNumericUpDown.Increment = new decimal(new int[] { … … 288 299 this.lockAspectCheckBox.UseVisualStyleBackColor = true; 289 300 // 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 // 290 335 // regressionGroupBox 291 336 // … … 295 340 this.regressionGroupBox.Controls.Add(this.label4); 296 341 this.regressionGroupBox.Dock = System.Windows.Forms.DockStyle.Bottom; 297 this.regressionGroupBox.Location = new System.Drawing.Point(0, 32 4);342 this.regressionGroupBox.Location = new System.Drawing.Point(0, 322); 298 343 this.regressionGroupBox.Name = "regressionGroupBox"; 299 this.regressionGroupBox.Size = new System.Drawing.Size(180, 79);344 this.regressionGroupBox.Size = new System.Drawing.Size(180, 81); 300 345 this.regressionGroupBox.TabIndex = 3; 301 346 this.regressionGroupBox.TabStop = false; … … 304 349 // regressionTypeComboBox 305 350 // 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) 307 352 | System.Windows.Forms.AnchorStyles.Right))); 308 353 this.regressionTypeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; … … 316 361 // polynomialRegressionOrderNumericUpDown 317 362 // 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) 319 364 | System.Windows.Forms.AnchorStyles.Right))); 320 365 this.polynomialRegressionOrderNumericUpDown.Location = new System.Drawing.Point(67, 45); … … 360 405 // groupingOptionsBox 361 406 // 407 this.groupingOptionsBox.Controls.Add(this.aggregationLabel); 408 this.groupingOptionsBox.Controls.Add(this.aggregationComboBox); 362 409 this.groupingOptionsBox.Controls.Add(this.groupingComboBox); 363 410 this.groupingOptionsBox.Dock = System.Windows.Forms.DockStyle.Bottom; 364 this.groupingOptionsBox.Location = new System.Drawing.Point(0, 2 74);411 this.groupingOptionsBox.Location = new System.Drawing.Point(0, 241); 365 412 this.groupingOptionsBox.Name = "groupingOptionsBox"; 366 this.groupingOptionsBox.Size = new System.Drawing.Size(180, 50);413 this.groupingOptionsBox.Size = new System.Drawing.Size(180, 81); 367 414 this.groupingOptionsBox.TabIndex = 8; 368 415 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); 370 439 // 371 440 // groupingComboBox 372 441 // 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) 374 443 | System.Windows.Forms.AnchorStyles.Right))); 375 444 this.groupingComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; … … 380 449 this.groupingComboBox.TabIndex = 1; 381 450 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"; 382 500 // 383 501 // ScatterPlotMultiView … … 401 519 ((System.ComponentModel.ISupportInitialize)(this.heightNumericUpDown)).EndInit(); 402 520 ((System.ComponentModel.ISupportInitialize)(this.widthNumericUpDown)).EndInit(); 521 ((System.ComponentModel.ISupportInitialize)(this.pointSizeNumericUpDown)).EndInit(); 403 522 this.regressionGroupBox.ResumeLayout(false); 404 523 this.regressionGroupBox.PerformLayout(); 405 524 ((System.ComponentModel.ISupportInitialize)(this.polynomialRegressionOrderNumericUpDown)).EndInit(); 406 525 this.groupingOptionsBox.ResumeLayout(false); 526 this.groupingOptionsBox.PerformLayout(); 527 ((System.ComponentModel.ISupportInitialize)(this.pointOpacityNumericUpDown)).EndInit(); 528 this.pointsGroupBox.ResumeLayout(false); 529 this.pointsGroupBox.PerformLayout(); 407 530 this.ResumeLayout(false); 408 531 … … 431 554 private System.Windows.Forms.NumericUpDown heightNumericUpDown; 432 555 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; 433 563 } 434 564 } -
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.cs
r14953 r14975 31 31 using HeuristicLab.MainForm; 32 32 using HeuristicLab.MainForm.WindowsForms; 33 using AggregationType = HeuristicLab.Analysis.DataRowVisualProperties.DataRowHistogramAggregation; 33 34 using RegressionType = HeuristicLab.Analysis.ScatterPlotDataRowVisualProperties.ScatterPlotDataRowRegressionType; 34 35 … … 50 51 regressionTypeComboBox.SelectedItem = RegressionType.None; 51 52 53 aggregationComboBox.DataSource = Enum.GetValues(typeof(AggregationType)); 54 aggregationComboBox.SelectedItem = AggregationType.Overlapping; 55 52 56 #region Initialize Scrollbars 53 57 columnHeaderScrollPanel.HorizontalScroll.Enabled = true; … … 85 89 groupingComboBox.SelectedItem = Content.GroupingVariable; 86 90 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 } 87 106 GenerateCharts(true); 88 107 } … … 93 112 var regressionType = (RegressionType)regressionTypeComboBox.SelectedValue; 94 113 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; 95 118 } 96 119 97 120 protected override void CheckedItemsChanged(object sender, CollectionItemsChangedEventArgs<IndexedItem<StringValue>> checkedItems) { 98 121 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); 104 127 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 110 257 private void AddChartToTable(string variable) { 111 258 frameTableLayoutPanel.SuspendLayout(); … … 226 373 tlp.RowStyles.RemoveAt(tlp.RowCount - 1); 227 374 tlp.RowCount--; 228 }229 #endregion230 231 #region Add/Remove/Update Variable232 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 caches241 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);262 375 } 263 376 #endregion … … 295 408 if (!bodyCache.ContainsKey(key)) { 296 409 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; 298 416 foreach (var dataRow in dataTable.Rows) 299 dataRow.VisualProperties.IsVisibleInLegend = false; 300 417 dataRow.VisualProperties.IsVisibleInLegend = groupingComboBox.SelectedIndex > 0; 301 418 var pcv = new DataTableControl { 302 419 Name = key.ToString(), … … 309 426 bodyCache.Add(key, pcv); 310 427 } 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); 312 432 var regressionType = (RegressionType)regressionTypeComboBox.SelectedValue; 313 433 int order = (int)polynomialRegressionOrderNumericUpDown.Value; 434 int i = 0; 435 var colors = PreprocessingChartView.Colors; 314 436 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; 316 441 row.VisualProperties.IsRegressionVisibleInLegend = false; 317 442 row.VisualProperties.RegressionType = regressionType; … … 342 467 if (suppressCheckedChangedUpdate) return; 343 468 344 var variables = GetCheckedVariables();345 346 469 // Clear old layouts and cache 347 470 foreach (var tableLayoutPanel in new[] { columnHeaderTableLayoutPanel, rowHeaderTableLayoutPanel, bodyTableLayoutPanel }) { … … 362 485 } 363 486 487 var variables = Content.VariableItemList.Select(x => x.Value).ToList(); 488 364 489 // Set row and column count 365 490 columnHeaderTableLayoutPanel.ColumnCount = variables.Count; … … 370 495 // Set column and row layout 371 496 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)); 376 502 } 377 503 … … 384 510 385 511 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 } 391 518 } 392 519 } 393 520 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; 396 523 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; 399 526 if (!IsVariableChecked(rowVar)) continue; 400 527 bodyTableLayoutPanel.Controls.Add(GetBody(colVar, rowVar), c, r); 401 r++; 402 } 403 c++; 528 } 404 529 } 405 530 UpdateRegressionLine(); … … 429 554 DataTableControl pcv = (DataTableControl)sender; 430 555 HistogramContent histoContent = new HistogramContent(Content.PreprocessingData); // create new content 431 //ToDo: histoContent.VariableItemList = Content.CreateVariableItemList();556 //ToDo: histoContent.VariableItemList = Content.CreateVariableItemList(); 432 557 var dataTable = pcv.Content; 433 558 … … 501 626 } 502 627 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 } 505 632 } 506 633 oldWidth = GetColumnWidth(); … … 516 643 } 517 644 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 } 520 649 } 521 650 oldWidth = GetColumnWidth(); 522 651 oldHeight = GetRowHeight(); 523 652 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 } 524 678 } 525 679 #endregion … … 540 694 int order = (int)polynomialRegressionOrderNumericUpDown.Value; 541 695 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; 544 703 if (scatterPlotControl != null) { 545 704 foreach (var row in scatterPlotControl.Content.Rows) { … … 553 712 #endregion 554 713 714 #region Grouping 555 715 private void groupingComboBox_SelectedIndexChanged(object sender, EventArgs e) { 716 aggregationComboBox.Enabled = groupingComboBox.SelectedIndex > 0; 556 717 GenerateCharts(true); // new series within charts -> clear cache 557 718 } 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 558 737 } 559 738 }
Note: See TracChangeset
for help on using the changeset viewer.