Changeset 9240 for branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Optimization.Views/3.3/RunCollectionViews
- Timestamp:
- 02/21/13 16:20:52 (12 years ago)
- Location:
- branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Optimization.Views
- Files:
-
- 4 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Optimization.Views
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
/trunk/sources/HeuristicLab.Optimization.Views merged eligible /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTree/HeuristicLab.Optimization.Views 3219-3222
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
-
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.Designer.cs
r7967 r9240 46 46 private void InitializeComponent() { 47 47 this.components = new System.ComponentModel.Container(); 48 System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea 2= new System.Windows.Forms.DataVisualization.Charting.ChartArea();49 System.Windows.Forms.DataVisualization.Charting.Series series 2= new System.Windows.Forms.DataVisualization.Charting.Series();48 System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); 49 System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); 50 50 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RunCollectionBubbleChartView)); 51 51 this.yJitterLabel = new System.Windows.Forms.Label(); … … 72 72 this.noRunsLabel = new System.Windows.Forms.Label(); 73 73 this.sizeTrackBar = new System.Windows.Forms.TrackBar(); 74 this.getDataAsMatrixToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 74 75 ((System.ComponentModel.ISupportInitialize)(this.xTrackBar)).BeginInit(); 75 76 ((System.ComponentModel.ISupportInitialize)(this.yTrackBar)).BeginInit(); … … 188 189 // 189 190 this.chart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 190 191 192 chartArea 2.Name = "ChartArea1";193 this.chart.ChartAreas.Add(chartArea 2);191 | System.Windows.Forms.AnchorStyles.Left) 192 | System.Windows.Forms.AnchorStyles.Right))); 193 chartArea1.Name = "ChartArea1"; 194 this.chart.ChartAreas.Add(chartArea1); 194 195 this.chart.Location = new System.Drawing.Point(6, 30); 195 196 this.chart.Name = "chart"; 196 series 2.ChartArea = "ChartArea1";197 series 2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;198 series 2.IsVisibleInLegend = false;199 series 2.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle;200 series 2.Name = "Bubbles";201 series 2.YValuesPerPoint = 2;202 this.chart.Series.Add(series 2);197 series1.ChartArea = "ChartArea1"; 198 series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; 199 series1.IsVisibleInLegend = false; 200 series1.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; 201 series1.Name = "Bubbles"; 202 series1.YValuesPerPoint = 2; 203 this.chart.Series.Add(series1); 203 204 this.chart.Size = new System.Drawing.Size(843, 425); 204 205 this.chart.TabIndex = 16; … … 215 216 this.openBoxPlotViewToolStripMenuItem.Text = "Open BoxPlot View"; 216 217 this.openBoxPlotViewToolStripMenuItem.Click += new System.EventHandler(this.openBoxPlotViewToolStripMenuItem_Click); 217 // 218 // 218 219 // hideRunToolStripMenuItem 219 // 220 // 220 221 this.hideRunToolStripMenuItem.Name = "hideRunToolStripMenuItem"; 221 222 this.hideRunToolStripMenuItem.Size = new System.Drawing.Size(256, 22); 222 223 this.hideRunToolStripMenuItem.Text = "Hide Run"; 223 this.hideRunToolStripMenuItem.Click += new System.EventHandler( hideRunToolStripMenuItem_Click);224 this.hideRunToolStripMenuItem.Click += new System.EventHandler(this.hideRunToolStripMenuItem_Click); 224 225 // 225 226 // zoomButton … … 325 326 this.sizeTrackBar.Value = 10; 326 327 this.sizeTrackBar.ValueChanged += new System.EventHandler(this.sizeTrackBar_ValueChanged); 328 // 329 // ToolStripMenuItem 330 // 331 this.getDataAsMatrixToolStripMenuItem.Name = "getDataAsMatrixToolStripMenuItem"; 332 this.getDataAsMatrixToolStripMenuItem.Size = new System.Drawing.Size(256, 22); 333 this.getDataAsMatrixToolStripMenuItem.Text = "Get Data as Matrix"; 334 this.getDataAsMatrixToolStripMenuItem.Click += new System.EventHandler(this.getDataAsMatrixToolStripMenuItem_Click); 327 335 // 328 336 // RunCollectionBubbleChartView … … 386 394 private System.Windows.Forms.Button colorYAxisButton; 387 395 private System.Windows.Forms.TrackBar sizeTrackBar; 396 private System.Windows.Forms.ToolStripMenuItem getDataAsMatrixToolStripMenuItem; 388 397 } 389 398 } -
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.cs
r9068 r9240 20 20 #endregion 21 21 22 using HeuristicLab.Common; 23 using HeuristicLab.Core; 24 using HeuristicLab.Data; 25 using HeuristicLab.MainForm; 26 using HeuristicLab.MainForm.WindowsForms; 22 27 using System; 23 28 using System.Collections.Generic; … … 26 31 using System.Windows.Forms; 27 32 using System.Windows.Forms.DataVisualization.Charting; 28 using HeuristicLab.Common;29 using HeuristicLab.Core;30 using HeuristicLab.Data;31 using HeuristicLab.MainForm;32 using HeuristicLab.MainForm.WindowsForms;33 33 34 34 namespace HeuristicLab.Optimization.Views { … … 58 58 chart.ContextMenuStrip.Items.Insert(0, hideRunToolStripMenuItem); 59 59 chart.ContextMenuStrip.Items.Insert(1, openBoxPlotViewToolStripMenuItem); 60 chart.ContextMenuStrip.Items.Add(getDataAsMatrixToolStripMenuItem); 60 61 chart.ContextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(ContextMenuStrip_Opening); 61 62 … … 688 689 boxplotView.Show(); 689 690 } 691 692 private void getDataAsMatrixToolStripMenuItem_Click(object sender, EventArgs e) { 693 int xCol = Matrix.ColumnNames.ToList().IndexOf(xAxisValue); 694 var grouped = new Dictionary<string, List<string>>(); 695 Dictionary<double, string> reverseMapping = null; 696 if (categoricalMapping.ContainsKey(xCol)) 697 reverseMapping = categoricalMapping[xCol].ToDictionary(x => x.Value, y => y.Key.ToString()); 698 foreach (var run in Content.Where(r => r.Visible)) { 699 var x = GetValue(run, xAxisValue); 700 var y = GetValue(run, yAxisValue); 701 if (!(x.HasValue && y.HasValue)) continue; 702 703 var category = reverseMapping == null ? x.Value.ToString() : reverseMapping[x.Value]; 704 if (!grouped.ContainsKey(category)) grouped[category] = new List<string>(); 705 grouped[category].Add(y.Value.ToString()); 706 } 707 708 if (!grouped.Any()) return; 709 var matrix = new StringMatrix(grouped.Values.Max(x => x.Count), grouped.Count) { 710 ColumnNames = grouped.Keys.ToArray() 711 }; 712 int i = 0; 713 foreach (var col in matrix.ColumnNames) { 714 int j = 0; 715 foreach (var y in grouped[col]) 716 matrix[j++, i] = y; 717 i++; 718 } 719 720 MainFormManager.MainForm.ShowContent(matrix); 721 } 690 722 #endregion 691 723 -
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionDataTableView.Designer.cs
r8925 r9240 49 49 this.label2 = new System.Windows.Forms.Label(); 50 50 this.dataRowComboBox = new System.Windows.Forms.ComboBox(); 51 this.meanButton = new System.Windows.Forms.Button(); 51 52 this.SuspendLayout(); 52 53 // 53 54 // dataTableComboBox 54 55 // 55 this.dataTableComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)56 | System.Windows.Forms.AnchorStyles.Right)));57 56 this.dataTableComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 58 57 this.dataTableComboBox.FormattingEnabled = true; 59 58 this.dataTableComboBox.Location = new System.Drawing.Point(69, 3); 60 59 this.dataTableComboBox.Name = "dataTableComboBox"; 61 this.dataTableComboBox.Size = new System.Drawing.Size( 455, 21);60 this.dataTableComboBox.Size = new System.Drawing.Size(360, 21); 62 61 this.dataTableComboBox.TabIndex = 0; 63 62 this.dataTableComboBox.SelectedIndexChanged += new System.EventHandler(this.dataTableComboBox_SelectedIndexChanged); … … 74 73 // viewHost 75 74 // 76 this.viewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 77 | System.Windows.Forms.AnchorStyles.Left) 75 this.viewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 76 | System.Windows.Forms.AnchorStyles.Left) 78 77 | System.Windows.Forms.AnchorStyles.Right))); 79 78 this.viewHost.Caption = "View"; … … 99 98 // dataRowComboBox 100 99 // 101 this.dataRowComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)102 | System.Windows.Forms.AnchorStyles.Right)));103 100 this.dataRowComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 104 101 this.dataRowComboBox.FormattingEnabled = true; 105 102 this.dataRowComboBox.Location = new System.Drawing.Point(69, 30); 106 103 this.dataRowComboBox.Name = "dataRowComboBox"; 107 this.dataRowComboBox.Size = new System.Drawing.Size( 455, 21);104 this.dataRowComboBox.Size = new System.Drawing.Size(360, 21); 108 105 this.dataRowComboBox.TabIndex = 4; 109 106 this.dataRowComboBox.SelectedIndexChanged += new System.EventHandler(this.dataRowComboBox_SelectedIndexChanged); 110 107 // 108 // meanButton 109 // 110 this.meanButton.Location = new System.Drawing.Point(436, 3); 111 this.meanButton.Name = "meanButton"; 112 this.meanButton.Size = new System.Drawing.Size(88, 48); 113 this.meanButton.TabIndex = 5; 114 this.meanButton.Text = "Compute Mean"; 115 this.meanButton.UseVisualStyleBackColor = true; 116 this.meanButton.Click += new System.EventHandler(this.meanButton_Click); 117 // 111 118 // RunCollectionDataTableView 112 119 // 113 this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);114 120 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 121 this.Controls.Add(this.meanButton); 115 122 this.Controls.Add(this.dataRowComboBox); 116 123 this.Controls.Add(this.label2); … … 132 139 private System.Windows.Forms.Label label2; 133 140 private System.Windows.Forms.ComboBox dataRowComboBox; 141 private System.Windows.Forms.Button meanButton; 134 142 } 135 143 } -
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionDataTableView.cs
r8962 r9240 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using System.Text; 25 26 using System.Windows.Forms; 26 27 using HeuristicLab.Analysis; … … 226 227 } 227 228 private void dataRowComboBox_SelectedIndexChanged(object sender, System.EventArgs e) { 229 CombinedDataTable.Rows.Clear(); // to also clear the mean values row 228 230 RebuildCombinedDataTable(); 231 } 232 233 private void meanButton_Click(object sender, EventArgs e) { 234 var caption = (string)dataRowComboBox.SelectedItem + " Mean Values"; 235 236 var rows = combinedDataTable.Rows.ToList(); 237 238 if (combinedDataTable.Rows.ContainsKey(caption)) 239 combinedDataTable.Rows.Remove(caption); 240 241 // add an additional data row with the mean values 242 int maxCount = combinedDataTable.Rows.Max(row => row.Values.Count); 243 int rowCount = combinedDataTable.Rows.Count; 244 var meanValues = new List<double>(); 245 246 for (int i = 0; i != maxCount; ++i) { 247 double mean = 0; 248 for (int j = 0; j != rowCount; ++j) { 249 mean += i < rows[j].Values.Count ? rows[j].Values[i] : 0; 250 } 251 meanValues.Add(mean / rowCount); 252 } 253 254 combinedDataTable.Rows.Add(new DataRow(caption)); 255 combinedDataTable.Rows[caption].Values.AddRange(meanValues); 256 var sb = new StringBuilder(); 257 foreach (var val in meanValues) 258 sb.AppendLine(val.ToString()); 259 Clipboard.SetText(sb.ToString()); 229 260 } 230 261 }
Note: See TracChangeset
for help on using the changeset viewer.