Changeset 8925
- Timestamp:
- 11/20/12 12:13:24 (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
r8924 r8925 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();53 51 this.SuspendLayout(); 54 52 // 55 53 // dataTableComboBox 56 54 // 57 this.dataTableComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 55 this.dataTableComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 58 56 | System.Windows.Forms.AnchorStyles.Right))); 59 57 this.dataTableComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; … … 76 74 // viewHost 77 75 // 78 this.viewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 79 | System.Windows.Forms.AnchorStyles.Left) 76 this.viewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 77 | System.Windows.Forms.AnchorStyles.Left) 80 78 | System.Windows.Forms.AnchorStyles.Right))); 81 79 this.viewHost.Caption = "View"; … … 101 99 // dataRowComboBox 102 100 // 103 this.dataRowComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 101 this.dataRowComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 104 102 | System.Windows.Forms.AnchorStyles.Right))); 105 103 this.dataRowComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; … … 111 109 this.dataRowComboBox.SelectedIndexChanged += new System.EventHandler(this.dataRowComboBox_SelectedIndexChanged); 112 110 // 113 // label3114 //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 // groupByComboBox123 //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 //138 111 // RunCollectionDataTableView 139 112 // 113 this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); 140 114 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 141 this.Controls.Add(this.groupByComboBox);142 this.Controls.Add(this.label3);143 115 this.Controls.Add(this.dataRowComboBox); 144 116 this.Controls.Add(this.label2); … … 160 132 private System.Windows.Forms.Label label2; 161 133 private System.Windows.Forms.ComboBox dataRowComboBox; 162 private System.Windows.Forms.Label label3;163 private System.Windows.Forms.ComboBox groupByComboBox;164 134 } 165 135 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionDataTableView.cs
r8924 r8925 220 220 dataRowComboBox.Items.Add(AllDataRows); 221 221 if (dataRowComboBox.Items.Count > 0) dataRowComboBox.SelectedItem = dataRowComboBox.Items[0]; 222 groupByComboBox.SelectedItem = groupByComboBox.Items[0];223 222 } 224 223 … … 227 226 } 228 227 private void dataRowComboBox_SelectedIndexChanged(object sender, System.EventArgs e) { 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 } 228 RebuildCombinedDataTable(); 271 229 } 272 230 }
Note: See TracChangeset
for help on using the changeset viewer.