Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9087


Ignore:
Timestamp:
12/21/12 11:00:42 (12 years ago)
Author:
ascheibe
Message:

#1886 added coloring of the rows in the statistical view

Location:
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/RunCollectionStatisticalTabularView.cs

    r9061 r9087  
    2222using System;
    2323using System.Collections.Generic;
     24using System.Drawing;
    2425using System.Linq;
    2526using System.Windows.Forms;
     
    261262      Content.Modify();
    262263    }
     264
     265    private void colorButton_Click(object sender, EventArgs e) {
     266      string resultName = (string)dataTableComboBox.SelectedItem;
     267      string rowName = (string)dataRowComboBox.SelectedItem;
     268      var runs = Content.Where(x => x.Results.ContainsKey(resultName));
     269      Dictionary<int, double> values = new Dictionary<int, double>();
     270
     271      if (stringConvertibleMatrixView.DataGridView.CurrentCell != null) {
     272        int curIndex = stringConvertibleMatrixView.DataGridView.CurrentCell.ColumnIndex;
     273
     274        for (int i = 0; i < stringConvertibleMatrixView.Content.Rows; i++) {
     275          values[i] = double.Parse(stringConvertibleMatrixView.Content.GetValue(i, curIndex));
     276        }
     277
     278        var orderedValues = values.OrderBy(x => x.Value);
     279
     280        for (int i = 0; i < orderedValues.Count(); i++) {
     281          var row = stringConvertibleMatrixView.DataGridView.Rows[orderedValues.ElementAt(i).Key];
     282
     283          int r = (int)Math.Round((double)i / (double)orderedValues.Count() * 255.0);
     284          int g = (int)Math.Round(((double)orderedValues.Count() - (double)i) / (double)orderedValues.Count() * 255.0);
     285
     286          Color color = Color.FromArgb(r, g, 0);
     287          row.DefaultCellStyle.ForeColor = color;
     288        }
     289      }
     290    }
    263291  }
    264292}
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/RunCollectionStatisticalTabularView.designer.cs

    r8569 r9087  
    5252      this.addLineToChart = new System.Windows.Forms.Button();
    5353      this.addValuesButton = new System.Windows.Forms.Button();
     54      this.colorButton = new System.Windows.Forms.Button();
    5455      this.SuspendLayout();
    5556      //
    5657      // stringConvertibleMatrixView
    5758      //
    58       this.stringConvertibleMatrixView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    59             | System.Windows.Forms.AnchorStyles.Left) 
     59      this.stringConvertibleMatrixView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     60            | System.Windows.Forms.AnchorStyles.Left)
    6061            | System.Windows.Forms.AnchorStyles.Right)));
    6162      this.stringConvertibleMatrixView.Caption = "StringConvertibleMatrix View";
     
    7172      // dataRowComboBox
    7273      //
    73       this.dataRowComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     74      this.dataRowComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    7475            | System.Windows.Forms.AnchorStyles.Right)));
    7576      this.dataRowComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     
    101102      // dataTableComboBox
    102103      //
    103       this.dataTableComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     104      this.dataTableComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    104105            | System.Windows.Forms.AnchorStyles.Right)));
    105106      this.dataTableComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     
    133134      this.addValuesButton.Click += new System.EventHandler(this.addValuesButton_Click);
    134135      //
     136      // colorButton
     137      //
     138      this.colorButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     139      this.colorButton.Location = new System.Drawing.Point(200, 359);
     140      this.colorButton.Name = "colorButton";
     141      this.colorButton.Size = new System.Drawing.Size(75, 23);
     142      this.colorButton.TabIndex = 11;
     143      this.colorButton.Text = "Color Rows";
     144      this.colorButton.UseVisualStyleBackColor = true;
     145      this.colorButton.Click += new System.EventHandler(this.colorButton_Click);
     146      //
    135147      // RunCollectionStatisticalTabularView
    136148      //
     149      this.Controls.Add(this.colorButton);
    137150      this.Controls.Add(this.addValuesButton);
    138151      this.Controls.Add(this.addLineToChart);
     
    157170    private System.Windows.Forms.Button addLineToChart;
    158171    private System.Windows.Forms.Button addValuesButton;
     172    private System.Windows.Forms.Button colorButton;
    159173  }
    160174}
Note: See TracChangeset for help on using the changeset viewer.