- Timestamp:
- 11/20/12 12:04:35 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionDataTableView.Designer.cs
r7980 r8924 49 49 this.label2 = new System.Windows.Forms.Label(); 50 50 this.dataRowComboBox = new System.Windows.Forms.ComboBox(); 51 this.label3 = new System.Windows.Forms.Label(); 52 this.groupByComboBox = new System.Windows.Forms.ComboBox(); 51 53 this.SuspendLayout(); 52 54 // 53 55 // dataTableComboBox 54 56 // 55 this.dataTableComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 57 this.dataTableComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 56 58 | System.Windows.Forms.AnchorStyles.Right))); 57 59 this.dataTableComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; … … 74 76 // viewHost 75 77 // 76 this.viewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 77 | System.Windows.Forms.AnchorStyles.Left) 78 this.viewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 79 | System.Windows.Forms.AnchorStyles.Left) 78 80 | System.Windows.Forms.AnchorStyles.Right))); 79 81 this.viewHost.Caption = "View"; … … 99 101 // dataRowComboBox 100 102 // 101 this.dataRowComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 103 this.dataRowComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 102 104 | System.Windows.Forms.AnchorStyles.Right))); 103 105 this.dataRowComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; … … 109 111 this.dataRowComboBox.SelectedIndexChanged += new System.EventHandler(this.dataRowComboBox_SelectedIndexChanged); 110 112 // 113 // label3 114 // 115 this.label3.AutoSize = true; 116 this.label3.Location = new System.Drawing.Point(3, 61); 117 this.label3.Name = "label3"; 118 this.label3.Size = new System.Drawing.Size(53, 13); 119 this.label3.TabIndex = 5; 120 this.label3.Text = "Grouping:"; 121 // 122 // groupByComboBox 123 // 124 this.groupByComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 125 | System.Windows.Forms.AnchorStyles.Right))); 126 this.groupByComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 127 this.groupByComboBox.FormattingEnabled = true; 128 this.groupByComboBox.Items.AddRange(new object[] { 129 "None", 130 "Same runs", 131 "All"}); 132 this.groupByComboBox.Location = new System.Drawing.Point(69, 58); 133 this.groupByComboBox.Name = "groupByComboBox"; 134 this.groupByComboBox.Size = new System.Drawing.Size(455, 21); 135 this.groupByComboBox.TabIndex = 6; 136 this.groupByComboBox.SelectedIndexChanged += new System.EventHandler(this.groupByComboBox_SelectedIndexChanged); 137 // 111 138 // RunCollectionDataTableView 112 139 // 113 this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);114 140 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 141 this.Controls.Add(this.groupByComboBox); 142 this.Controls.Add(this.label3); 115 143 this.Controls.Add(this.dataRowComboBox); 116 144 this.Controls.Add(this.label2); … … 132 160 private System.Windows.Forms.Label label2; 133 161 private System.Windows.Forms.ComboBox dataRowComboBox; 162 private System.Windows.Forms.Label label3; 163 private System.Windows.Forms.ComboBox groupByComboBox; 134 164 } 135 165 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionDataTableView.cs
r8738 r8924 220 220 dataRowComboBox.Items.Add(AllDataRows); 221 221 if (dataRowComboBox.Items.Count > 0) dataRowComboBox.SelectedItem = dataRowComboBox.Items[0]; 222 groupByComboBox.SelectedItem = groupByComboBox.Items[0]; 222 223 } 223 224 … … 226 227 } 227 228 private void dataRowComboBox_SelectedIndexChanged(object sender, System.EventArgs e) { 228 RebuildCombinedDataTable(); 229 // RebuildCombinedDataTable(); 230 groupByComboBox_SelectedIndexChanged(sender, e); 231 } 232 private void groupByComboBox_SelectedIndexChanged(object sender, System.EventArgs e) { 233 var resultName = (string)dataTableComboBox.SelectedItem; 234 var groupByCriteriaName = (string)groupByComboBox.SelectedItem; 235 switch (groupByCriteriaName) { 236 case ("None"): { 237 combinedDataTable.Rows.Clear(); 238 RebuildCombinedDataTable(); 239 break; 240 } 241 case ("Same runs"): { 242 var rowName = (string)dataRowComboBox.SelectedItem; 243 var runGroups = Content.GroupBy(r => r.Algorithm); 244 combinedDataTable.Rows.Clear(); 245 foreach (var g in runGroups) { 246 var dataTable = g.Select(r => r.Results[resultName] as DataTable); 247 var rows = dataTable.SelectMany(d => d.Rows.Where(row => row.Name == rowName)).ToList(); 248 var avgRow = new DataRow { VisualProperties = { StartIndexZero = true }, Name = resultName + "." + rowName }; 249 var min = rows.Min(r => r.Values.Count); 250 for (int i = 0; i != min; ++i) { 251 avgRow.Values.Add(rows.Average(r => r.Values[i])); 252 } 253 combinedDataTable.Rows.Add(avgRow); 254 } 255 break; 256 } 257 case ("All"): { 258 var rowName = (string)dataRowComboBox.SelectedItem; 259 RebuildCombinedDataTable(); 260 var rows = combinedDataTable.Rows; 261 var avgRow = new DataRow { VisualProperties = { StartIndexZero = true }, Name = resultName + "." + rowName }; 262 var min = rows.Min(r => r.Values.Count); 263 for (int i = 0; i != min; ++i) { 264 avgRow.Values.Add(rows.Average(r => r.Values[i])); 265 } 266 combinedDataTable.Rows.Clear(); 267 combinedDataTable.Rows.Add(avgRow); 268 break; 269 } 270 } 229 271 } 230 272 }
Note: See TracChangeset
for help on using the changeset viewer.