- Timestamp:
- 01/25/13 16:20:13 (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/RunCollectionBubbleChartView.Designer.cs
r7967 r9190 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 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.cs
r9068 r9190 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
Note: See TracChangeset
for help on using the changeset viewer.