Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9240


Ignore:
Timestamp:
02/21/13 16:20:52 (12 years ago)
Author:
bburlacu
Message:

#1772: Merged trunk changes for HeuristicLab.Optimization.Views. Modified RunCollectionDataTableView to calculate rows mean and put the results into the clipboard.

Location:
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Optimization.Views
Files:
5 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Optimization.Views

  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Optimization.Views/3.3/HeuristicLab.Optimization.Views-3.3.csproj

    r9079 r9240  
    4141    <DebugType>full</DebugType>
    4242    <Optimize>false</Optimize>
    43     <OutputPath>$(SolutionDir)\bin\</OutputPath>
     43    <OutputPath>..\..\..\..\Trunk\sources\bin\</OutputPath>
    4444    <DefineConstants>DEBUG;TRACE</DefineConstants>
    4545    <ErrorReport>prompt</ErrorReport>
     
    5050    <DebugType>pdbonly</DebugType>
    5151    <Optimize>true</Optimize>
    52     <OutputPath>$(SolutionDir)\bin\</OutputPath>
     52    <OutputPath>..\..\..\..\Trunk\sources\bin\</OutputPath>
    5353    <DefineConstants>TRACE</DefineConstants>
    5454    <ErrorReport>prompt</ErrorReport>
     
    9999  </PropertyGroup>
    100100  <ItemGroup>
     101    <Reference Include="HeuristicLab.Analysis-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     102      <SpecificVersion>False</SpecificVersion>
     103      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Analysis-3.3.dll</HintPath>
     104    </Reference>
     105    <Reference Include="HeuristicLab.Analysis.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     106      <SpecificVersion>False</SpecificVersion>
     107      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Analysis.Views-3.3.dll</HintPath>
     108    </Reference>
     109    <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     110      <SpecificVersion>False</SpecificVersion>
     111      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath>
     112    </Reference>
     113    <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     114      <SpecificVersion>False</SpecificVersion>
     115      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
     116    </Reference>
     117    <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     118      <SpecificVersion>False</SpecificVersion>
     119      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath>
     120    </Reference>
     121    <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     122      <SpecificVersion>False</SpecificVersion>
     123      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
     124    </Reference>
     125    <Reference Include="HeuristicLab.Core.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     126      <SpecificVersion>False</SpecificVersion>
     127      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Core.Views-3.3.dll</HintPath>
     128    </Reference>
     129    <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     130      <SpecificVersion>False</SpecificVersion>
     131      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
     132    </Reference>
     133    <Reference Include="HeuristicLab.Data.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     134      <SpecificVersion>False</SpecificVersion>
     135      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Data.Views-3.3.dll</HintPath>
     136    </Reference>
     137    <Reference Include="HeuristicLab.MainForm-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     138      <SpecificVersion>False</SpecificVersion>
     139      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.MainForm-3.3.dll</HintPath>
     140    </Reference>
     141    <Reference Include="HeuristicLab.MainForm.WindowsForms-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     142      <SpecificVersion>False</SpecificVersion>
     143      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.MainForm.WindowsForms-3.3.dll</HintPath>
     144    </Reference>
     145    <Reference Include="HeuristicLab.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     146      <SpecificVersion>False</SpecificVersion>
     147      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
     148    </Reference>
     149    <Reference Include="HeuristicLab.PluginInfrastructure-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     150      <SpecificVersion>False</SpecificVersion>
     151      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
     152    </Reference>
     153    <Reference Include="HeuristicLab.Problems.Instances-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     154      <SpecificVersion>False</SpecificVersion>
     155      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath>
     156    </Reference>
     157    <Reference Include="HeuristicLab.Problems.Instances.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     158      <SpecificVersion>False</SpecificVersion>
     159      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Problems.Instances.Views-3.3.dll</HintPath>
     160    </Reference>
     161    <Reference Include="HeuristicLab.Visualization.ChartControlsExtensions-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     162      <SpecificVersion>False</SpecificVersion>
     163      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Visualization.ChartControlsExtensions-3.3.dll</HintPath>
     164    </Reference>
    101165    <Reference Include="Microsoft.CSharp" />
    102166    <Reference Include="System" />
     
    317381  </ItemGroup>
    318382  <ItemGroup>
    319     <ProjectReference Include="..\..\HeuristicLab.Analysis.Views\3.3\HeuristicLab.Analysis.Views-3.3.csproj">
    320       <Project>{76945D76-CA61-4147-9DC2-0ACDCDDF87F9}</Project>
    321       <Name>HeuristicLab.Analysis.Views-3.3</Name>
    322       <Private>False</Private>
    323     </ProjectReference>
    324     <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
    325       <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>
    326       <Name>HeuristicLab.Collections-3.3</Name>
    327       <Private>False</Private>
    328     </ProjectReference>
    329     <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.3\HeuristicLab.Common.Resources-3.3.csproj">
    330       <Project>{0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}</Project>
    331       <Name>HeuristicLab.Common.Resources-3.3</Name>
    332       <Private>False</Private>
    333     </ProjectReference>
    334     <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj">
    335       <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project>
    336       <Name>HeuristicLab.Common-3.3</Name>
    337       <Private>False</Private>
    338     </ProjectReference>
    339     <ProjectReference Include="..\..\HeuristicLab.Core.Views\3.3\HeuristicLab.Core.Views-3.3.csproj">
    340       <Project>{E226881D-315F-423D-B419-A766FE0D8685}</Project>
    341       <Name>HeuristicLab.Core.Views-3.3</Name>
    342       <Private>False</Private>
    343     </ProjectReference>
    344     <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
    345       <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project>
    346       <Name>HeuristicLab.Core-3.3</Name>
    347       <Private>False</Private>
    348     </ProjectReference>
    349     <ProjectReference Include="..\..\HeuristicLab.Data.Views\3.3\HeuristicLab.Data.Views-3.3.csproj">
    350       <Project>{72104A0B-90E7-42F3-9ABE-9BBBADD4B943}</Project>
    351       <Name>HeuristicLab.Data.Views-3.3</Name>
    352       <Private>False</Private>
    353     </ProjectReference>
    354     <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj">
    355       <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project>
    356       <Name>HeuristicLab.Data-3.3</Name>
    357       <Private>False</Private>
    358     </ProjectReference>
    359     <ProjectReference Include="..\..\HeuristicLab.MainForm.WindowsForms\3.3\HeuristicLab.MainForm.WindowsForms-3.3.csproj">
    360       <Project>{AB687BBE-1BFE-476B-906D-44237135431D}</Project>
    361       <Name>HeuristicLab.MainForm.WindowsForms-3.3</Name>
    362       <Private>False</Private>
    363     </ProjectReference>
    364     <ProjectReference Include="..\..\HeuristicLab.MainForm\3.3\HeuristicLab.MainForm-3.3.csproj">
    365       <Project>{3BD61258-31DA-4B09-89C0-4F71FEF5F05A}</Project>
    366       <Name>HeuristicLab.MainForm-3.3</Name>
    367       <Private>False</Private>
    368     </ProjectReference>
    369     <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
    370       <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project>
    371       <Name>HeuristicLab.Optimization-3.3</Name>
    372       <Private>False</Private>
    373     </ProjectReference>
    374     <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">
    375       <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
    376       <Name>HeuristicLab.PluginInfrastructure-3.3</Name>
    377       <Private>False</Private>
    378     </ProjectReference>
    379     <ProjectReference Include="..\..\HeuristicLab.Problems.Instances.Views\3.3\HeuristicLab.Problems.Instances.Views-3.3.csproj">
    380       <Project>{B1BA398F-953F-4C3A-B07B-1E5E17A27DD9}</Project>
    381       <Name>HeuristicLab.Problems.Instances.Views-3.3</Name>
    382       <Private>False</Private>
    383     </ProjectReference>
    384     <ProjectReference Include="..\..\HeuristicLab.Problems.Instances\3.3\HeuristicLab.Problems.Instances-3.3.csproj">
    385       <Project>{3540E29E-4793-49E7-8EE2-FEA7F61C3994}</Project>
    386       <Name>HeuristicLab.Problems.Instances-3.3</Name>
    387       <Private>False</Private>
    388     </ProjectReference>
    389     <ProjectReference Include="..\..\HeuristicLab.Visualization.ChartControlsExtensions\3.3\HeuristicLab.Visualization.ChartControlsExtensions-3.3.csproj">
    390       <Project>{315BDA09-3F4F-49B3-9790-B37CFC1C5750}</Project>
    391       <Name>HeuristicLab.Visualization.ChartControlsExtensions-3.3</Name>
    392       <Private>False</Private>
    393     </ProjectReference>
    394     <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj">
    395       <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project>
    396       <Name>HeuristicLab.Analysis-3.3</Name>
    397       <Private>False</Private>
    398     </ProjectReference>
     383    <EmbeddedResource Include="RunCollectionViews\RunCollectionDataTableView.resx">
     384      <DependentUpon>RunCollectionDataTableView.cs</DependentUpon>
     385    </EmbeddedResource>
    399386  </ItemGroup>
    400387  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.Designer.cs

    r7967 r9240  
    4646    private void InitializeComponent() {
    4747      this.components = new System.ComponentModel.Container();
    48       System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
    49       System.Windows.Forms.DataVisualization.Charting.Series series2 = 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();
    5050      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RunCollectionBubbleChartView));
    5151      this.yJitterLabel = new System.Windows.Forms.Label();
     
    7272      this.noRunsLabel = new System.Windows.Forms.Label();
    7373      this.sizeTrackBar = new System.Windows.Forms.TrackBar();
     74      this.getDataAsMatrixToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    7475      ((System.ComponentModel.ISupportInitialize)(this.xTrackBar)).BeginInit();
    7576      ((System.ComponentModel.ISupportInitialize)(this.yTrackBar)).BeginInit();
     
    188189      //
    189190      this.chart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    190                   | System.Windows.Forms.AnchorStyles.Left)
    191                   | System.Windows.Forms.AnchorStyles.Right)));
    192       chartArea2.Name = "ChartArea1";
    193       this.chart.ChartAreas.Add(chartArea2);
     191            | System.Windows.Forms.AnchorStyles.Left)
     192            | System.Windows.Forms.AnchorStyles.Right)));
     193      chartArea1.Name = "ChartArea1";
     194      this.chart.ChartAreas.Add(chartArea1);
    194195      this.chart.Location = new System.Drawing.Point(6, 30);
    195196      this.chart.Name = "chart";
    196       series2.ChartArea = "ChartArea1";
    197       series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
    198       series2.IsVisibleInLegend = false;
    199       series2.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle;
    200       series2.Name = "Bubbles";
    201       series2.YValuesPerPoint = 2;
    202       this.chart.Series.Add(series2);
     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);
    203204      this.chart.Size = new System.Drawing.Size(843, 425);
    204205      this.chart.TabIndex = 16;
     
    215216      this.openBoxPlotViewToolStripMenuItem.Text = "Open BoxPlot View";
    216217      this.openBoxPlotViewToolStripMenuItem.Click += new System.EventHandler(this.openBoxPlotViewToolStripMenuItem_Click);
    217       //
     218      // 
    218219      // hideRunToolStripMenuItem
    219       //
     220      // 
    220221      this.hideRunToolStripMenuItem.Name = "hideRunToolStripMenuItem";
    221222      this.hideRunToolStripMenuItem.Size = new System.Drawing.Size(256, 22);
    222223      this.hideRunToolStripMenuItem.Text = "Hide Run";
    223       this.hideRunToolStripMenuItem.Click += new System.EventHandler(hideRunToolStripMenuItem_Click);
     224      this.hideRunToolStripMenuItem.Click += new System.EventHandler(this.hideRunToolStripMenuItem_Click);
    224225      //
    225226      // zoomButton
     
    325326      this.sizeTrackBar.Value = 10;
    326327      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);
    327335      //
    328336      // RunCollectionBubbleChartView
     
    386394    private System.Windows.Forms.Button colorYAxisButton;
    387395    private System.Windows.Forms.TrackBar sizeTrackBar;
     396    private System.Windows.Forms.ToolStripMenuItem getDataAsMatrixToolStripMenuItem;
    388397  }
    389398}
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.cs

    r9068 r9240  
    2020#endregion
    2121
     22using HeuristicLab.Common;
     23using HeuristicLab.Core;
     24using HeuristicLab.Data;
     25using HeuristicLab.MainForm;
     26using HeuristicLab.MainForm.WindowsForms;
    2227using System;
    2328using System.Collections.Generic;
     
    2631using System.Windows.Forms;
    2732using 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;
    3333
    3434namespace HeuristicLab.Optimization.Views {
     
    5858      chart.ContextMenuStrip.Items.Insert(0, hideRunToolStripMenuItem);
    5959      chart.ContextMenuStrip.Items.Insert(1, openBoxPlotViewToolStripMenuItem);
     60      chart.ContextMenuStrip.Items.Add(getDataAsMatrixToolStripMenuItem);
    6061      chart.ContextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(ContextMenuStrip_Opening);
    6162
     
    688689      boxplotView.Show();
    689690    }
     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    }
    690722    #endregion
    691723
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionDataTableView.Designer.cs

    r8925 r9240  
    4949      this.label2 = new System.Windows.Forms.Label();
    5050      this.dataRowComboBox = new System.Windows.Forms.ComboBox();
     51      this.meanButton = new System.Windows.Forms.Button();
    5152      this.SuspendLayout();
    5253      //
    5354      // dataTableComboBox
    5455      //
    55       this.dataTableComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    56             | System.Windows.Forms.AnchorStyles.Right)));
    5756      this.dataTableComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    5857      this.dataTableComboBox.FormattingEnabled = true;
    5958      this.dataTableComboBox.Location = new System.Drawing.Point(69, 3);
    6059      this.dataTableComboBox.Name = "dataTableComboBox";
    61       this.dataTableComboBox.Size = new System.Drawing.Size(455, 21);
     60      this.dataTableComboBox.Size = new System.Drawing.Size(360, 21);
    6261      this.dataTableComboBox.TabIndex = 0;
    6362      this.dataTableComboBox.SelectedIndexChanged += new System.EventHandler(this.dataTableComboBox_SelectedIndexChanged);
     
    7473      // viewHost
    7574      //
    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) 
    7877            | System.Windows.Forms.AnchorStyles.Right)));
    7978      this.viewHost.Caption = "View";
     
    9998      // dataRowComboBox
    10099      //
    101       this.dataRowComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    102             | System.Windows.Forms.AnchorStyles.Right)));
    103100      this.dataRowComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    104101      this.dataRowComboBox.FormattingEnabled = true;
    105102      this.dataRowComboBox.Location = new System.Drawing.Point(69, 30);
    106103      this.dataRowComboBox.Name = "dataRowComboBox";
    107       this.dataRowComboBox.Size = new System.Drawing.Size(455, 21);
     104      this.dataRowComboBox.Size = new System.Drawing.Size(360, 21);
    108105      this.dataRowComboBox.TabIndex = 4;
    109106      this.dataRowComboBox.SelectedIndexChanged += new System.EventHandler(this.dataRowComboBox_SelectedIndexChanged);
    110107      //
     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      //
    111118      // RunCollectionDataTableView
    112119      //
    113       this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
    114120      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
     121      this.Controls.Add(this.meanButton);
    115122      this.Controls.Add(this.dataRowComboBox);
    116123      this.Controls.Add(this.label2);
     
    132139    private System.Windows.Forms.Label label2;
    133140    private System.Windows.Forms.ComboBox dataRowComboBox;
     141    private System.Windows.Forms.Button meanButton;
    134142  }
    135143}
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionDataTableView.cs

    r8962 r9240  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using System.Text;
    2526using System.Windows.Forms;
    2627using HeuristicLab.Analysis;
     
    226227    }
    227228    private void dataRowComboBox_SelectedIndexChanged(object sender, System.EventArgs e) {
     229      CombinedDataTable.Rows.Clear(); // to also clear the mean values row
    228230      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());
    229260    }
    230261  }
Note: See TracChangeset for help on using the changeset viewer.