Changeset 14994


Ignore:
Timestamp:
05/17/17 14:37:40 (4 years ago)
Author:
pfleck
Message:

#2709 Added Check All/Inputs/None Buttons for the feature correlation view.

Location:
branches/DataPreprocessing Enhancements
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingFeatureCorrelationView.Designer.cs

    r14185 r14994  
    2222#endregion
    2323
    24 namespace HeuristicLab.Problems.DataAnalysis.Views {
     24namespace HeuristicLab.DataPreprocessing.Views {
    2525  partial class PreprocessingFeatureCorrelationView {
    2626    /// <summary>
     
    4848    private void InitializeComponent() {
    4949      this.components = new System.ComponentModel.Container();
     50      this.checkInputsTargetButton = new System.Windows.Forms.Button();
     51      this.uncheckAllButton = new System.Windows.Forms.Button();
     52      this.checkAllButton = new System.Windows.Forms.Button();
     53      this.correlationView = new HeuristicLab.Problems.DataAnalysis.Views.FeatureCorrelationView();
     54      this.variablesLabel = new System.Windows.Forms.Label();
     55      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
     56      this.SuspendLayout();
     57      //
     58      // checkInputsTargetButton
     59      //
     60      this.checkInputsTargetButton.Image = global::HeuristicLab.DataPreprocessing.Views.PreprocessingIcons.Inputs;
     61      this.checkInputsTargetButton.Location = new System.Drawing.Point(736, 5);
     62      this.checkInputsTargetButton.Name = "checkInputsTargetButton";
     63      this.checkInputsTargetButton.Size = new System.Drawing.Size(24, 24);
     64      this.checkInputsTargetButton.TabIndex = 14;
     65      this.toolTip.SetToolTip(this.checkInputsTargetButton, "Inputs & Target Variables");
     66      this.checkInputsTargetButton.UseVisualStyleBackColor = true;
     67      this.checkInputsTargetButton.Click += new System.EventHandler(this.checkInputsTargetButton_Click);
     68      //
     69      // uncheckAllButton
     70      //
     71      this.uncheckAllButton.Image = global::HeuristicLab.DataPreprocessing.Views.PreprocessingIcons.None;
     72      this.uncheckAllButton.Location = new System.Drawing.Point(766, 5);
     73      this.uncheckAllButton.Name = "uncheckAllButton";
     74      this.uncheckAllButton.Size = new System.Drawing.Size(24, 24);
     75      this.uncheckAllButton.TabIndex = 12;
     76      this.toolTip.SetToolTip(this.uncheckAllButton, "None");
     77      this.uncheckAllButton.UseVisualStyleBackColor = true;
     78      this.uncheckAllButton.Click += new System.EventHandler(this.uncheckAllButton_Click);
     79      //
     80      // checkAllButton
     81      //
     82      this.checkAllButton.Image = global::HeuristicLab.DataPreprocessing.Views.PreprocessingIcons.All;
     83      this.checkAllButton.Location = new System.Drawing.Point(706, 5);
     84      this.checkAllButton.Name = "checkAllButton";
     85      this.checkAllButton.Size = new System.Drawing.Size(24, 24);
     86      this.checkAllButton.TabIndex = 13;
     87      this.toolTip.SetToolTip(this.checkAllButton, "All");
     88      this.checkAllButton.UseVisualStyleBackColor = true;
     89      this.checkAllButton.Click += new System.EventHandler(this.checkAllButton_Click);
     90      //
     91      // correlationView
     92      //
     93      this.correlationView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     94            | System.Windows.Forms.AnchorStyles.Left)
     95            | System.Windows.Forms.AnchorStyles.Right)));
     96      this.correlationView.Caption = "Feature Correlation View";
     97      this.correlationView.Content = null;
     98      this.correlationView.Location = new System.Drawing.Point(0, 0);
     99      this.correlationView.Name = "correlationView";
     100      this.correlationView.ReadOnly = false;
     101      this.correlationView.Size = new System.Drawing.Size(1013, 640);
     102      this.correlationView.TabIndex = 18;
     103      //
     104      // variablesLabel
     105      //
     106      this.variablesLabel.AutoSize = true;
     107      this.variablesLabel.Location = new System.Drawing.Point(650, 11);
     108      this.variablesLabel.Name = "variablesLabel";
     109      this.variablesLabel.Size = new System.Drawing.Size(50, 13);
     110      this.variablesLabel.TabIndex = 15;
     111      this.variablesLabel.Text = "Variables";
     112      //
     113      // PreprocessingFeatureCorrelationView
     114      //
     115      this.Controls.Add(this.variablesLabel);
     116      this.Controls.Add(this.checkInputsTargetButton);
     117      this.Controls.Add(this.uncheckAllButton);
     118      this.Controls.Add(this.checkAllButton);
     119      this.Controls.Add(this.correlationView);
     120      this.Name = "PreprocessingFeatureCorrelationView";
     121      this.Size = new System.Drawing.Size(1013, 640);
    50122      this.ResumeLayout(false);
     123      this.PerformLayout();
     124
    51125    }
    52126
    53127    #endregion
     128    private System.Windows.Forms.Button checkInputsTargetButton;
     129    private System.Windows.Forms.Button uncheckAllButton;
     130    private System.Windows.Forms.Button checkAllButton;
     131    private HeuristicLab.Problems.DataAnalysis.Views.FeatureCorrelationView correlationView;
     132    private System.Windows.Forms.ToolTip toolTip;
     133    private System.Windows.Forms.Label variablesLabel;
    54134  }
    55135}
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingFeatureCorrelationView.cs

    r14470 r14994  
    2020#endregion
    2121
    22 using System.Windows.Forms;
    23 using HeuristicLab.DataPreprocessing;
     22using System;
     23using System.Linq;
     24using HeuristicLab.Data.Views;
    2425using HeuristicLab.MainForm;
    2526using HeuristicLab.MainForm.WindowsForms;
    2627
    27 namespace HeuristicLab.Problems.DataAnalysis.Views {
     28namespace HeuristicLab.DataPreprocessing.Views {
    2829  [View("Preprocessing Feature Correlation View")]
    2930  [Content(typeof(CorrelationMatrixContent), true)]
     
    3536    }
    3637
    37     FeatureCorrelationView correlationView;
    38 
    3938    public PreprocessingFeatureCorrelationView() {
    4039      InitializeComponent();
    41       correlationView = new FeatureCorrelationView();
    42       correlationView.Dock = DockStyle.Fill;
    43       this.Controls.Add(correlationView);
    4440    }
    45 
    4641
    4742    protected override void RegisterContentEvents() {
     
    6156    protected override void OnContentChanged() {
    6257      base.OnContentChanged();
    63       if (Content == null) {
    64         correlationView.Content = null;
     58      correlationView.Content = Content != null ? Content.ProblemData : null;
     59    }
     60
     61    #region Check Variables
     62    private void checkAllButton_Click(object sender, System.EventArgs e) {
     63      SetVisibility(x => true);
     64    }
     65    private void checkInputsTargetButton_Click(object sender, System.EventArgs e) {
     66      var ppd = Content.PreprocessingData;
     67      SetVisibility(x => ppd.InputVariables.Contains(x) || ppd.TargetVariable == x);
     68    }
     69    private void uncheckAllButton_Click(object sender, System.EventArgs e) {
     70      SetVisibility(x => false);
     71    }
     72    private void SetVisibility(Func<string, bool> check) {
     73      var dataView = (EnhancedStringConvertibleMatrixView)correlationView.Controls.Find("DataView", searchAllChildren: true).Single();
     74      var ppd = Content.PreprocessingData;
     75      var visibilities = ppd.VariableNames.Where((v, i) => ppd.VariableHasType<double>(i)).Select(check).ToList();
     76      if (dataView.Content.Rows != dataView.Content.Columns || dataView.Content.Rows != visibilities.Count)
    6577        return;
    66       }
    6778
    68       correlationView.Content = Content.ProblemData;
     79      dataView.ColumnVisibility = visibilities;
     80      dataView.RowVisibility = visibilities;
     81      dataView.UpdateColumnHeaders();
     82      dataView.UpdateRowHeaders();
    6983    }
     84    #endregion
    7085  }
    7186}
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing/3.4/Content/CorrelationMatrixContent.cs

    r14467 r14994  
    3333
    3434    private PreprocessingContext Context { get; set; }
    35     private ITransactionalPreprocessingData PreprocessingData {
     35    public ITransactionalPreprocessingData PreprocessingData {
    3636      get { return Context.Data; }
    3737    }
Note: See TracChangeset for help on using the changeset viewer.