Changeset 9240 for branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.cs
- Timestamp:
- 02/21/13 16:20:52 (12 years ago)
- Location:
- branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Optimization.Views
- Files:
-
- 1 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.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
Note: See TracChangeset
for help on using the changeset viewer.