Free cookie consent management tool by TermsFeed Policy Generator

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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.