Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14511 for branches


Ignore:
Timestamp:
12/20/16 15:28:14 (7 years ago)
Author:
pfleck
Message:

#2709

  • Added Check Inputs/All/None buttons instead of showing disabled buttons of the ItemCollectionView.
  • Removed the PreprocessingCheckedItemListView. A standard ListView is used instead.
  • Fixed slow updating when simultaneously (un-)checking multiple variables in the chart views. (currently only works by using the new buttons)
Location:
branches/DataPreprocessing Enhancements
Files:
2 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/HeuristicLab.DataPreprocessing.Views-3.4.csproj

    r14460 r14511  
    281281    <Compile Include="PreprocessingCheckedVariablesView.Designer.cs">
    282282      <DependentUpon>PreprocessingCheckedVariablesView.cs</DependentUpon>
    283     </Compile>
    284     <Compile Include="PreprocessingCheckedItemListView.cs">
    285       <SubType>UserControl</SubType>
    286     </Compile>
    287     <Compile Include="PreprocessingCheckedItemListView.Designer.cs">
    288       <DependentUpon>PreprocessingCheckedItemListView.cs</DependentUpon>
    289283    </Compile>
    290284    <Compile Include="Properties\AssemblyInfo.cs" />
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/LineChartView.Designer.cs

    r14268 r14511  
    6262      // optionsBox
    6363      //
    64       this.optionsBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
    65             | System.Windows.Forms.AnchorStyles.Right)));
    6664      this.optionsBox.Controls.Add(this.allInOneCheckBox);
    67       this.optionsBox.Location = new System.Drawing.Point(4, 262);
     65      this.optionsBox.Dock = System.Windows.Forms.DockStyle.Bottom;
     66      this.optionsBox.Location = new System.Drawing.Point(0, 357);
    6867      this.optionsBox.Name = "optionsBox";
    69       this.optionsBox.Size = new System.Drawing.Size(84, 138);
     68      this.optionsBox.Size = new System.Drawing.Size(180, 46);
    7069      this.optionsBox.TabIndex = 7;
    7170      this.optionsBox.TabStop = false;
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/LineChartView.cs

    r14473 r14511  
    6262
    6363      allInOneDataTable.Rows.Clear();
    64       foreach (var variable in Content.VariableItemList.CheckedItems) {
    65         allInOneDataTable.Rows.Add(allInOneDataRows[variable.Value.Value]);
    66       }
     64      var rows = Content.VariableItemList.CheckedItems.Select(v => allInOneDataRows[v.Value.Value]);
     65      allInOneDataTable.Rows.AddRange(rows);
    6766    }
    6867
     
    8382      dt.Rows.Add(row);
    8483
    85       try {
    86         double axisMin, axisMax, axisInterval;
    87         ChartUtil.CalculateOptimalAxisInterval(row.Values.Min(), row.Values.Max(), out axisMin, out axisMax, out axisInterval);
    88         dt.VisualProperties.YAxisMinimumAuto = false;
    89         dt.VisualProperties.YAxisMaximumAuto = false;
    90         dt.VisualProperties.YAxisMinimumFixedValue = axisMin;
    91         dt.VisualProperties.YAxisMaximumFixedValue = axisMax;
    92       } catch (ArgumentOutOfRangeException) { } // missing values lead to NaNs
     84      var validValues = row.Values.Where(x => !double.IsNaN(x) && !double.IsInfinity(x)).ToList();
     85      if (validValues.Any()) {
     86        try {
     87          double axisMin, axisMax, axisInterval;
     88          ChartUtil.CalculateOptimalAxisInterval(validValues.Min(), validValues.Max(), out axisMin, out axisMax, out axisInterval);
     89          dt.VisualProperties.YAxisMinimumAuto = false;
     90          dt.VisualProperties.YAxisMaximumAuto = false;
     91          dt.VisualProperties.YAxisMinimumFixedValue = axisMin;
     92          dt.VisualProperties.YAxisMaximumFixedValue = axisMax;
     93        } catch (ArgumentOutOfRangeException) { }
     94      }
    9395      return dt;
    9496    }
     
    116118          // ToDo: avoid clearing all rows, but how?
    117119          allInOneDataTable.Rows.Clear();
    118           foreach (var variable in Content.VariableItemList.CheckedItems) {
    119             allInOneDataTable.Rows.Add(allInOneDataRows[variable.Value.Value]);
    120           }
     120          var rows = Content.VariableItemList.CheckedItems.Select(r => allInOneDataRows[r.Value.Value]);
     121          allInOneDataTable.Rows.AddRange(rows);
    121122        } else {
    122123          allInOneDataTable.Rows.Remove(variableName);
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingChartView.cs

    r14459 r14511  
    6666
    6767    protected virtual int GetNumberOfVisibleDataTables() {
    68       return checkedItemList.Content.CheckedItems.Count();
     68      return Content.VariableItemList.CheckedItems.Count();
    6969    }
    7070
     
    150150    #endregion
    151151
     152    protected override void CheckedChangedUpdate() {
     153      GenerateLayout();
     154    }
     155
    152156    #region Generate Layout
    153157    protected void GenerateLayout() {
     158      if (suppressCheckedChangedUpdate)
     159        return;
     160
    154161      tableLayoutPanel.SuspendRepaint();
    155162
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingCheckedVariablesView.Designer.cs

    r14381 r14511  
    4747      this.components = new System.ComponentModel.Container();
    4848      this.splitContainer = new System.Windows.Forms.SplitContainer();
    49       this.checkedItemList = new HeuristicLab.DataPreprocessing.Views.PreprocessingCheckedItemListView();
    50       this.variablesListcontextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
    51       this.checkInputsTargetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    52       this.checkOnlyInputsTargetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    53       this.checkAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    54       this.uncheckAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     49      this.groupBox1 = new System.Windows.Forms.GroupBox();
     50      this.uncheckAllButton = new System.Windows.Forms.Button();
     51      this.checkAllButton = new System.Windows.Forms.Button();
     52      this.checkInputsTargetButton = new System.Windows.Forms.Button();
     53      this.variablesListView = new System.Windows.Forms.ListView();
     54      this.columnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
     55      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    5556      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
    5657      this.splitContainer.Panel1.SuspendLayout();
    5758      this.splitContainer.SuspendLayout();
    58       this.variablesListcontextMenuStrip.SuspendLayout();
     59      this.groupBox1.SuspendLayout();
    5960      this.SuspendLayout();
    6061      //
     
    6263      //
    6364      this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
     65      this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
    6466      this.splitContainer.Location = new System.Drawing.Point(0, 0);
    6567      this.splitContainer.Name = "splitContainer";
     
    6769      // splitContainer.Panel1
    6870      //
    69       this.splitContainer.Panel1.Controls.Add(this.checkedItemList);
     71      this.splitContainer.Panel1.Controls.Add(this.groupBox1);
    7072      this.splitContainer.Size = new System.Drawing.Size(654, 403);
    71       this.splitContainer.SplitterDistance = 91;
     73      this.splitContainer.SplitterDistance = 180;
    7274      this.splitContainer.TabIndex = 7;
    7375      //
    74       // checkedItemList
     76      // groupBox1
    7577      //
    76       this.checkedItemList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    77             | System.Windows.Forms.AnchorStyles.Left)
     78      this.groupBox1.Controls.Add(this.uncheckAllButton);
     79      this.groupBox1.Controls.Add(this.checkAllButton);
     80      this.groupBox1.Controls.Add(this.checkInputsTargetButton);
     81      this.groupBox1.Controls.Add(this.variablesListView);
     82      this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
     83      this.groupBox1.Location = new System.Drawing.Point(0, 0);
     84      this.groupBox1.Name = "groupBox1";
     85      this.groupBox1.Size = new System.Drawing.Size(180, 403);
     86      this.groupBox1.TabIndex = 7;
     87      this.groupBox1.TabStop = false;
     88      this.groupBox1.Text = "Variables";
     89      //
     90      // uncheckAllButton
     91      //
     92      this.uncheckAllButton.Location = new System.Drawing.Point(66, 19);
     93      this.uncheckAllButton.Name = "uncheckAllButton";
     94      this.uncheckAllButton.Size = new System.Drawing.Size(24, 24);
     95      this.uncheckAllButton.TabIndex = 7;
     96      this.uncheckAllButton.Text = "N";
     97      this.toolTip.SetToolTip(this.uncheckAllButton, "Uncheck all variables");
     98      this.uncheckAllButton.UseVisualStyleBackColor = true;
     99      this.uncheckAllButton.Click += new System.EventHandler(this.uncheckAllButton_Click);
     100      //
     101      // checkAllButton
     102      //
     103      this.checkAllButton.Location = new System.Drawing.Point(36, 19);
     104      this.checkAllButton.Name = "checkAllButton";
     105      this.checkAllButton.Size = new System.Drawing.Size(24, 24);
     106      this.checkAllButton.TabIndex = 7;
     107      this.checkAllButton.Text = "A";
     108      this.toolTip.SetToolTip(this.checkAllButton, "Check all variables");
     109      this.checkAllButton.UseVisualStyleBackColor = true;
     110      this.checkAllButton.Click += new System.EventHandler(this.checkAllButton_Click);
     111      //
     112      // checkInputsTargetButton
     113      //
     114      this.checkInputsTargetButton.Location = new System.Drawing.Point(6, 19);
     115      this.checkInputsTargetButton.Name = "checkInputsTargetButton";
     116      this.checkInputsTargetButton.Size = new System.Drawing.Size(24, 24);
     117      this.checkInputsTargetButton.TabIndex = 7;
     118      this.checkInputsTargetButton.Text = "I";
     119      this.toolTip.SetToolTip(this.checkInputsTargetButton, "Check only inputs and target variable");
     120      this.checkInputsTargetButton.UseVisualStyleBackColor = true;
     121      this.checkInputsTargetButton.Click += new System.EventHandler(this.checkInputsTargetButton_Click);
     122      //
     123      // variablesListView
     124      //
     125      this.variablesListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     126            | System.Windows.Forms.AnchorStyles.Left)
    78127            | System.Windows.Forms.AnchorStyles.Right)));
    79       this.checkedItemList.Caption = "View";
    80       this.checkedItemList.Content = null;
    81       this.checkedItemList.ContextMenuStrip = this.variablesListcontextMenuStrip;
    82       this.checkedItemList.Location = new System.Drawing.Point(4, 4);
    83       this.checkedItemList.Name = "checkedItemList";
    84       this.checkedItemList.ReadOnly = false;
    85       this.checkedItemList.Size = new System.Drawing.Size(84, 252);
    86       this.checkedItemList.TabIndex = 4;
     128      this.variablesListView.CheckBoxes = true;
     129      this.variablesListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
     130            this.columnHeader});
     131      this.variablesListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
     132      this.variablesListView.HideSelection = false;
     133      this.variablesListView.Location = new System.Drawing.Point(6, 49);
     134      this.variablesListView.Name = "variablesListView";
     135      this.variablesListView.Size = new System.Drawing.Size(168, 348);
     136      this.variablesListView.TabIndex = 6;
     137      this.variablesListView.UseCompatibleStateImageBehavior = false;
     138      this.variablesListView.View = System.Windows.Forms.View.Details;
    87139      //
    88       // variablesListcontextMenuStrip
     140      // columnHeader
    89141      //
    90       this.variablesListcontextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
    91             this.checkInputsTargetToolStripMenuItem,
    92             this.checkOnlyInputsTargetToolStripMenuItem,
    93             this.checkAllToolStripMenuItem,
    94             this.uncheckAllToolStripMenuItem});
    95       this.variablesListcontextMenuStrip.Name = "variablesListcontextMenuStrip";
    96       this.variablesListcontextMenuStrip.Size = new System.Drawing.Size(211, 92);
    97       this.variablesListcontextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(this.variablesListcontextMenuStrip_Opening);
    98       //
    99       // checkInputsTargetToolStripMenuItem
    100       //
    101       this.checkInputsTargetToolStripMenuItem.Name = "checkInputsTargetToolStripMenuItem";
    102       this.checkInputsTargetToolStripMenuItem.Size = new System.Drawing.Size(210, 22);
    103       this.checkInputsTargetToolStripMenuItem.Text = "Check Inputs+Target";
    104       this.checkInputsTargetToolStripMenuItem.Click += new System.EventHandler(this.checkInputsTargetToolStripMenuItem_Click);
    105       //
    106       // checkOnlyInputsTargetToolStripMenuItem
    107       //
    108       this.checkOnlyInputsTargetToolStripMenuItem.Name = "checkOnlyInputsTargetToolStripMenuItem";
    109       this.checkOnlyInputsTargetToolStripMenuItem.Size = new System.Drawing.Size(210, 22);
    110       this.checkOnlyInputsTargetToolStripMenuItem.Text = "Check only Inputs+Target";
    111       this.checkOnlyInputsTargetToolStripMenuItem.Click += new System.EventHandler(this.checkOnlyInputsTargetToolStripMenuItem_Click);
    112       //
    113       // checkAllToolStripMenuItem
    114       //
    115       this.checkAllToolStripMenuItem.Name = "checkAllToolStripMenuItem";
    116       this.checkAllToolStripMenuItem.Size = new System.Drawing.Size(210, 22);
    117       this.checkAllToolStripMenuItem.Text = "Check All";
    118       this.checkAllToolStripMenuItem.Click += new System.EventHandler(this.checkAllToolStripMenuItem_Click);
    119       //
    120       // uncheckAllToolStripMenuItem
    121       //
    122       this.uncheckAllToolStripMenuItem.Name = "uncheckAllToolStripMenuItem";
    123       this.uncheckAllToolStripMenuItem.Size = new System.Drawing.Size(210, 22);
    124       this.uncheckAllToolStripMenuItem.Text = "Uncheck All";
    125       this.uncheckAllToolStripMenuItem.Click += new System.EventHandler(this.uncheckAllToolStripMenuItem_Click);
     142      this.columnHeader.Text = "";
     143      this.columnHeader.Width = 164;
    126144      //
    127145      // PreprocessingCheckedVariablesView
     
    135153      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
    136154      this.splitContainer.ResumeLayout(false);
    137       this.variablesListcontextMenuStrip.ResumeLayout(false);
     155      this.groupBox1.ResumeLayout(false);
    138156      this.ResumeLayout(false);
    139157
     
    141159
    142160    #endregion
    143 
    144     protected PreprocessingCheckedItemListView checkedItemList;
    145161    protected System.Windows.Forms.SplitContainer splitContainer;
    146     private System.Windows.Forms.ContextMenuStrip variablesListcontextMenuStrip;
    147     private System.Windows.Forms.ToolStripMenuItem checkInputsTargetToolStripMenuItem;
    148     private System.Windows.Forms.ToolStripMenuItem checkAllToolStripMenuItem;
    149     private System.Windows.Forms.ToolStripMenuItem uncheckAllToolStripMenuItem;
    150     private System.Windows.Forms.ToolStripMenuItem checkOnlyInputsTargetToolStripMenuItem;
     162    private System.Windows.Forms.ListView variablesListView;
     163    private System.Windows.Forms.GroupBox groupBox1;
     164    private System.Windows.Forms.ToolTip toolTip;
     165    private System.Windows.Forms.ColumnHeader columnHeader;
     166    private System.Windows.Forms.Button checkInputsTargetButton;
     167    private System.Windows.Forms.Button uncheckAllButton;
     168    private System.Windows.Forms.Button checkAllButton;
    151169  }
    152170}
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingCheckedVariablesView.cs

    r14459 r14511  
    2020#endregion
    2121
    22 using System;
    2322using System.Collections.Generic;
    2423using System.Drawing;
     
    2625using System.Windows.Forms;
    2726using HeuristicLab.Collections;
     27using HeuristicLab.Common.Resources;
    2828using HeuristicLab.Core.Views;
    2929using HeuristicLab.Data;
     
    3535  public partial class PreprocessingCheckedVariablesView : ItemView {
    3636
     37    protected bool suppressCheckedChangedUpdate = false;
     38
    3739    public new PreprocessingChartContent Content {
    3840      get { return (PreprocessingChartContent)base.Content; }
     
    4244    protected PreprocessingCheckedVariablesView() {
    4345      InitializeComponent();
     46      checkInputsTargetButton.Text = string.Empty;
     47      checkInputsTargetButton.Image = VSImageLibrary.Namespace;
     48      checkAllButton.Text = string.Empty;
     49      checkAllButton.Image = VSImageLibrary.Expand;
     50      uncheckAllButton.Text = string.Empty;
     51      uncheckAllButton.Image = VSImageLibrary.Collapse;
    4452    }
    4553
     
    4856    }
    4957    protected IList<string> GetCheckedVariables() {
    50       return checkedItemList.Content.CheckedItems.Select(i => i.Value.Value).ToList();
     58      return Content.VariableItemList.CheckedItems.Select(i => i.Value.Value).ToList();
    5159    }
    5260
     
    5563      if (Content == null) return;
    5664
    57       if (Content.VariableItemList == null) {
    58         IList<string> inputs = Content.PreprocessingData.InputVariables;
    59         if (Content.PreprocessingData.TargetVariable != null)
    60           inputs = inputs.Union(new[] { Content.PreprocessingData.TargetVariable }).ToList();
    61         Content.VariableItemList = Content.CreateVariableItemList(inputs);
    62       } else {
    63         var checkedNames = Content.VariableItemList.CheckedItems.Select(x => x.Value.Value);
    64         Content.VariableItemList = Content.CreateVariableItemList(checkedNames.ToList());
     65      variablesListView.ItemChecked -= variablesListView_ItemChecked;
     66      variablesListView.Items.Clear();
     67      foreach (var variable in Content.VariableItemList) {
     68        bool isInputTarget = Content.PreprocessingData.InputVariables.Contains(variable.Value)
     69          || Content.PreprocessingData.TargetVariable == variable.Value;
     70        variablesListView.Items.Add(new ListViewItem(variable.Value) {
     71          Tag = variable,
     72          Checked = IsVariableChecked(variable.Value),
     73          ForeColor = isInputTarget ? Color.Black : Color.Gray
     74        });
    6575      }
    66       Content.VariableItemList.CheckedItemsChanged += CheckedItemsChanged;
    67 
    68       checkedItemList.Content = Content.VariableItemList;
    69       var target = Content.PreprocessingData.TargetVariable;
    70       var inputAndTarget = Content.PreprocessingData.InputVariables.Union(target != null ? new[] { target } : new string[] { });
    71       foreach (var col in Content.PreprocessingData.GetDoubleVariableNames().Except(inputAndTarget)) {
    72         var listViewItem = checkedItemList.ItemsListView.FindItemWithText(col, false, 0, false);
    73         listViewItem.ForeColor = Color.LightGray;
    74       }
     76      variablesListView.ItemChecked += variablesListView_ItemChecked;
    7577    }
    7678    protected override void RegisterContentEvents() {
    7779      base.RegisterContentEvents();
    7880      Content.PreprocessingData.Changed += PreprocessingData_Changed;
    79       Content.PreprocessingData.SelectionChanged += PreprocessingData_SelctionChanged;
     81      Content.VariableItemList.CheckedItemsChanged += CheckedItemsChanged;
    8082    }
     83
    8184    protected override void DeregisterContentEvents() {
    8285      Content.PreprocessingData.Changed -= PreprocessingData_Changed;
    83       Content.PreprocessingData.SelectionChanged -= PreprocessingData_SelctionChanged;
     86      Content.VariableItemList.CheckedItemsChanged -= CheckedItemsChanged;
    8487      base.DeregisterContentEvents();
    8588    }
    8689
    8790    protected virtual void CheckedItemsChanged(object sender, CollectionItemsChangedEventArgs<IndexedItem<StringValue>> checkedItems) {
     91      // sync listview
     92      foreach (var item in checkedItems.Items)
     93        variablesListView.Items[item.Index].Checked = Content.VariableItemList.ItemChecked(item.Value);
     94    }
     95    private void variablesListView_ItemChecked(object sender, ItemCheckedEventArgs e) {
     96      // sync checked item list
     97      var variable = (StringValue)e.Item.Tag;
     98      Content.VariableItemList.SetItemCheckedState(variable, e.Item.Checked);
    8899    }
    89100
     
    109120      Content.VariableItemList.Add(new StringValue(name));
    110121      if (!Content.PreprocessingData.InputVariables.Contains(name) && Content.PreprocessingData.TargetVariable != name) {
    111         var listViewItem = checkedItemList.ItemsListView.FindItemWithText(name, false, 0, false);
     122        var listViewItem = variablesListView.FindItemWithText(name, false, 0, false);
    112123        listViewItem.ForeColor = Color.LightGray;
    113124      }
     
    123134    }
    124135
    125     protected virtual void PreprocessingData_SelctionChanged(object sender, EventArgs e) {
     136    protected virtual void CheckedChangedUpdate() {
     137
    126138    }
    127139
    128     #region ContextMenu Events
    129     private void variablesListcontextMenuStrip_Opening(object sender, System.ComponentModel.CancelEventArgs e) {
    130       var data = Content.PreprocessingData;
    131       checkInputsTargetToolStripMenuItem.Text = "Check Inputs" + (data.TargetVariable != null ? "+Target" : "");
    132       checkOnlyInputsTargetToolStripMenuItem.Text = "Check only Inputs" + (data.TargetVariable != null ? "+Target" : "");
     140    private void checkInputsTargetButton_Click(object sender, System.EventArgs e) {
     141      suppressCheckedChangedUpdate = true;
     142      foreach (var name in Content.VariableItemList) {
     143        var isInputTarget = Content.PreprocessingData.InputVariables.Contains(name.Value) || Content.PreprocessingData.TargetVariable == name.Value;
     144        Content.VariableItemList.SetItemCheckedState(name, isInputTarget);
     145      }
     146      suppressCheckedChangedUpdate = false;
     147      CheckedChangedUpdate();
    133148    }
    134     private void checkInputsTargetToolStripMenuItem_Click(object sender, EventArgs e) {
    135       foreach (var name in checkedItemList.Content) {
    136         var isInputTarget = Content.PreprocessingData.InputVariables.Contains(name.Value) || Content.PreprocessingData.TargetVariable == name.Value;
    137         if (isInputTarget) {
    138           checkedItemList.Content.SetItemCheckedState(name, true);
    139         }
     149
     150    private void checkAllButton_Click(object sender, System.EventArgs e) {
     151      suppressCheckedChangedUpdate = true;
     152      foreach (var name in Content.VariableItemList) {
     153        Content.VariableItemList.SetItemCheckedState(name, true);
    140154      }
     155      suppressCheckedChangedUpdate = false;
     156      CheckedChangedUpdate();
    141157    }
    142     private void checkOnlyInputsTargetToolStripMenuItem_Click(object sender, EventArgs e) {
    143       foreach (var name in checkedItemList.Content) {
    144         var isInputTarget = Content.PreprocessingData.InputVariables.Contains(name.Value) || Content.PreprocessingData.TargetVariable == name.Value;
    145         checkedItemList.Content.SetItemCheckedState(name, isInputTarget);
     158
     159    private void uncheckAllButton_Click(object sender, System.EventArgs e) {
     160      suppressCheckedChangedUpdate = true;
     161      foreach (var name in Content.VariableItemList) {
     162        Content.VariableItemList.SetItemCheckedState(name, false);
    146163      }
     164      suppressCheckedChangedUpdate = false;
     165      CheckedChangedUpdate();
    147166    }
    148     private void checkAllToolStripMenuItem_Click(object sender, EventArgs e) {
    149       foreach (var name in checkedItemList.Content) {
    150         checkedItemList.Content.SetItemCheckedState(name, true);
    151       }
    152     }
    153     private void uncheckAllToolStripMenuItem_Click(object sender, EventArgs e) {
    154       foreach (var name in checkedItemList.Content) {
    155         checkedItemList.Content.SetItemCheckedState(name, false);
    156       }
    157     }
    158     #endregion
    159167  }
    160168}
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.Designer.cs

    r14388 r14511  
    7070      this.SuspendLayout();
    7171      //
    72       // checkedItemList
    73       //
    74       this.checkedItemList.Size = new System.Drawing.Size(113, 369);
    75       //
    7672      // splitContainer
    7773      //
     
    8480      //
    8581      this.splitContainer.Panel2.Controls.Add(this.frameTableLayoutPanel);
    86       this.splitContainer.Size = new System.Drawing.Size(863, 520);
    87       this.splitContainer.SplitterDistance = 120;
    8882      //
    8983      // frameTableLayoutPanel
     
    10195      this.frameTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F));
    10296      this.frameTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
    103       this.frameTableLayoutPanel.Size = new System.Drawing.Size(739, 520);
     97      this.frameTableLayoutPanel.Size = new System.Drawing.Size(470, 403);
    10498      this.frameTableLayoutPanel.TabIndex = 0;
    10599      //
     
    188182      // sizeGroupBox
    189183      //
    190       this.sizeGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
    191             | System.Windows.Forms.AnchorStyles.Right)));
    192184      this.sizeGroupBox.Controls.Add(this.heightLabel);
    193185      this.sizeGroupBox.Controls.Add(this.widthLabel);
    194186      this.sizeGroupBox.Controls.Add(this.heightTrackBar);
    195187      this.sizeGroupBox.Controls.Add(this.widthTrackBar);
    196       this.sizeGroupBox.Location = new System.Drawing.Point(4, 379);
     188      this.sizeGroupBox.Dock = System.Windows.Forms.DockStyle.Bottom;
     189      this.sizeGroupBox.Location = new System.Drawing.Point(0, 267);
    197190      this.sizeGroupBox.Name = "sizeGroupBox";
    198       this.sizeGroupBox.Size = new System.Drawing.Size(113, 124);
     191      this.sizeGroupBox.Size = new System.Drawing.Size(180, 136);
    199192      this.sizeGroupBox.TabIndex = 5;
    200193      this.sizeGroupBox.TabStop = false;
     
    227220      this.heightTrackBar.Maximum = 100;
    228221      this.heightTrackBar.Name = "heightTrackBar";
    229       this.heightTrackBar.Size = new System.Drawing.Size(101, 45);
     222      this.heightTrackBar.Size = new System.Drawing.Size(168, 45);
    230223      this.heightTrackBar.SmallChange = 10;
    231224      this.heightTrackBar.TabIndex = 0;
     
    242235      this.widthTrackBar.Maximum = 100;
    243236      this.widthTrackBar.Name = "widthTrackBar";
    244       this.widthTrackBar.Size = new System.Drawing.Size(101, 45);
     237      this.widthTrackBar.Size = new System.Drawing.Size(168, 45);
    245238      this.widthTrackBar.SmallChange = 10;
    246239      this.widthTrackBar.TabIndex = 0;
     
    254247      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    255248      this.Name = "ScatterPlotMultiView";
    256       this.Size = new System.Drawing.Size(863, 520);
    257249      this.splitContainer.Panel1.ResumeLayout(false);
    258250      this.splitContainer.Panel2.ResumeLayout(false);
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.cs

    r14495 r14511  
    6161    protected override void CheckedItemsChanged(object sender, CollectionItemsChangedEventArgs<IndexedItem<StringValue>> checkedItems) {
    6262      base.CheckedItemsChanged(sender, checkedItems);
     63      if (suppressCheckedChangedUpdate)
     64        return;
    6365      foreach (var variable in checkedItems.Items.Select(i => i.Value.Value)) {
    6466        if (IsVariableChecked(variable))
     
    7476
    7577      // find index to insert
    76       var variables = checkedItemList.Content.Select(v => v.Value).ToList();
     78      var variables = Content.VariableItemList.Select(v => v.Value).ToList();
    7779      int idx = variables              // all variables
    7880        .TakeWhile(t => t != variable) // ... until the variable that was checked
     
    285287    #endregion
    286288
     289    protected override void CheckedChangedUpdate() {
     290      GenerateCharts();
     291    }
     292
    287293    #region Generate Charts
    288294    private void GenerateCharts() {
     295      if (suppressCheckedChangedUpdate) return;
     296
    289297      var variables = GetCheckedVariables();
    290298
     
    365373      DataTableControl pcv = (DataTableControl)sender;
    366374      HistogramContent histoContent = new HistogramContent(Content.PreprocessingData);  // create new content     
    367       histoContent.VariableItemList = Content.CreateVariableItemList();
     375      //ToDo: histoContent.VariableItemList = Content.CreateVariableItemList();
    368376      var dataTable = pcv.Content;
    369377
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing/3.4/Content/PreprocessingChartContent.cs

    r14467 r14511  
    3636    private ICheckedItemList<StringValue> variableItemList = null;
    3737    public ICheckedItemList<StringValue> VariableItemList {
    38       get { return this.variableItemList; }
    39       set { this.variableItemList = value; }
     38      get {
     39        if (variableItemList == null)
     40          variableItemList = CreateVariableItemList();
     41        return this.variableItemList;
     42      }
     43      //set { this.variableItemList = value; }
    4044    }
    4145
     
    6569
    6670
    67     public ICheckedItemList<StringValue> CreateVariableItemList(IList<string> checkedItems = null) {
    68       if (checkedItems == null) checkedItems = new string[0];
     71    public ICheckedItemList<StringValue> CreateVariableItemList() {
    6972      ICheckedItemList<StringValue> itemList = new CheckedItemList<StringValue>();
    7073      foreach (string name in PreprocessingData.GetDoubleVariableNames()) {
    7174        var n = new StringValue(name);
    72         itemList.Add(n, checkedItems.Contains(name));
     75        bool isInputTarget = PreprocessingData.InputVariables.Contains(name) || PreprocessingData.TargetVariable == name;
     76        itemList.Add(n, isInputTarget);
    7377      }
    7478      return new ReadOnlyCheckedItemList<StringValue>(itemList);
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing/3.4/Content/ScatterPlotContent.cs

    r14495 r14511  
    4242      ScatterPlot scatterPlot = new ScatterPlot();
    4343
    44       IList<double> xValues = PreprocessingData.GetValues<double>(PreprocessingData.GetColumnIndex(variableNameX)).Where(x => !double.IsNaN(x) && !double.IsInfinity(x)).ToList();
    45       IList<double> yValues = PreprocessingData.GetValues<double>(PreprocessingData.GetColumnIndex(variableNameY)).Where(x => !double.IsNaN(x) && !double.IsInfinity(x)).ToList();
     44      IList<double> xValues = PreprocessingData.GetValues<double>(PreprocessingData.GetColumnIndex(variableNameX));
     45      IList<double> yValues = PreprocessingData.GetValues<double>(PreprocessingData.GetColumnIndex(variableNameY));
    4646
    47       if (xValues.Any()) {
     47      var points = xValues.Zip(yValues, (x, y) => new Point2D<double>(x, y)).ToList();
     48      var validPoints = points.Where(p => !double.IsNaN(p.X) && !double.IsNaN(p.Y) && !double.IsInfinity(p.X) && !double.IsInfinity(p.Y)).ToList();
     49      if (validPoints.Any()) {
    4850        try {
    4951          double axisMin, axisMax, axisInterval;
    50           ChartUtil.CalculateOptimalAxisInterval(xValues.Min(), xValues.Max(), out axisMin, out axisMax, out axisInterval);
     52          ChartUtil.CalculateOptimalAxisInterval(validPoints.Min(p => p.X), validPoints.Max(p => p.X), out axisMin, out axisMax, out axisInterval);
    5153          scatterPlot.VisualProperties.XAxisMinimumAuto = false;
    5254          scatterPlot.VisualProperties.XAxisMaximumAuto = false;
     
    5456          scatterPlot.VisualProperties.XAxisMaximumFixedValue = axisMax;
    5557        } catch (ArgumentOutOfRangeException) { } // error during CalculateOptimalAxisInterval
    56       }
    57       if (yValues.Any()) {
    5858        try {
    5959          double axisMin, axisMax, axisInterval;
    60           ChartUtil.CalculateOptimalAxisInterval(yValues.Min(), yValues.Max(), out axisMin, out axisMax, out axisInterval);
     60          ChartUtil.CalculateOptimalAxisInterval(validPoints.Min(p => p.Y), validPoints.Max(p => p.Y), out axisMin, out axisMax, out axisInterval);
    6161          scatterPlot.VisualProperties.YAxisMinimumAuto = false;
    6262          scatterPlot.VisualProperties.YAxisMaximumAuto = false;
     
    6767
    6868      if (variableNameGroup == null || variableNameGroup == "-") {
    69         List<Point2D<double>> points = new List<Point2D<double>>();
    70 
    71         for (int i = 0; i < xValues.Count; i++) {
    72           Point2D<double> point = new Point2D<double>(xValues[i], yValues[i]);
    73           points.Add(point);
    74         }
    75 
    76         ScatterPlotDataRow scdr = new ScatterPlotDataRow(variableNameX + " - " + variableNameY, "", points);
     69        ScatterPlotDataRow scdr = new ScatterPlotDataRow(variableNameX + " - " + variableNameY, "", validPoints);
    7770        scdr.VisualProperties.IsVisibleInLegend = false;
    7871        scatterPlot.Rows.Add(scdr);
    79 
    8072      } else {
    8173        var groupValues = PreprocessingData.GetValues<double>(PreprocessingData.GetColumnIndex(variableNameGroup));
    82         var data = xValues.Zip(yValues, (x, y) => new { x, y }).Zip(groupValues, (v, c) => new { v.x, v.y, c }).ToList();
     74        var data = points.Zip(groupValues, (p, g) => new { p, g });
    8375        foreach (var groupValue in groupValues.Distinct()) {
    84           var values = data.Where(x => x.c == groupValue);
    85           var row = new ScatterPlotDataRow(
    86             variableNameGroup + " (" + groupValue + ")",
    87             "",
    88             values.Select(v => new Point2D<double>(v.x, v.y))) {
     76          var values = data.Where(x => x.g == groupValue).Select(v => v.p);
     77          var row = new ScatterPlotDataRow(string.Format("{0} ({1})", variableNameGroup, groupValue), "", values) {
    8978            VisualProperties = { PointSize = 6 }
    9079          };
Note: See TracChangeset for help on using the changeset viewer.