Changeset 14418


Ignore:
Timestamp:
11/25/16 16:16:20 (4 years ago)
Author:
pfleck
Message:

#2698 Only input and target variables are pre-checked for linechart, histrogram and scatterplot.

Location:
trunk/sources
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingChartView.cs

    r14384 r14418  
    6161        InitData();
    6262        GenerateChart();
     63
     64        foreach (var row in dataRows) {
     65          string variableName = row.Name;
     66          if (!IsVariableChecked(variableName)) {
     67            dataTableView.SetRowEnabled(variableName, false);
     68            dataTable.SelectedRows.Remove(variableName);
     69            dataTablePerVariable.Remove(dataTablePerVariable.Find(x => (x.Name == variableName)));
     70          }
     71        }
    6372      }
    6473    }
     
    7180
    7281      //add data rows to data tables according to checked item list
    73       foreach (var checkedItem in Content.VariableItemList.CheckedItems) {
    74         string variableName = Content.VariableItemList[checkedItem.Index].Value;
     82      foreach (var row in dataRows) {
     83        string variableName = row.Name;
     84
     85        //add row to data table
     86        dataTable.Rows.Add(row);
     87
     88        //add row to data table per variable
    7589        PreprocessingDataTable d = new PreprocessingDataTable(variableName);
    76         DataRow row = GetDataRow(variableName);
    77 
    78         if (row != null) {
    79           //add row to data table
    80           dataTable.Rows.Add(row);
    81 
    82           //add row to data table per variable
    83           d.Rows.Add(row);
    84           dataTablePerVariable.Add(d);
    85         }
     90        d.Rows.Add(row);
     91        dataTablePerVariable.Add(d);
    8692      }
    8793
     
    95101        string variableName = item.Value.Value;
    96102
    97         // not checked -> remove
     103
    98104        if (!IsVariableChecked(variableName)) {
     105          // not checked -> remove
    99106          dataTableView.SetRowEnabled(variableName, false);
    100107          dataTable.SelectedRows.Remove(variableName);
    101108          dataTablePerVariable.Remove(dataTablePerVariable.Find(x => (x.Name == variableName)));
    102109        } else {
     110          // checked -> add
    103111          DataRow row = GetDataRow(variableName);
    104112          DataRow selectedRow = GetSelectedDataRow(variableName);
  • trunk/sources/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingCheckedVariablesView.cs

    r14384 r14418  
    5656
    5757      if (Content.VariableItemList == null) {
    58         Content.VariableItemList = Content.CreateVariableItemList();
     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);
    5962      } else {
    6063        var checkedNames = Content.VariableItemList.CheckedItems.Select(x => x.Value.Value);
    61         Content.VariableItemList = Content.CreateVariableItemList(checkedNames);
     64        Content.VariableItemList = Content.CreateVariableItemList(checkedNames.ToList());
    6265      }
    6366      Content.VariableItemList.CheckedItemsChanged += CheckedItemsChanged;
  • trunk/sources/HeuristicLab.DataPreprocessing/3.4/Content/PreprocessingChartContent.cs

    r14185 r14418  
    2323using System.Collections.Generic;
    2424using System.Drawing;
    25 using System.Linq;
    2625using HeuristicLab.Analysis;
    2726using HeuristicLab.Common;
     
    126125
    127126
    128     public ICheckedItemList<StringValue> CreateVariableItemList(IEnumerable<string> checkedItems = null) {
     127    public ICheckedItemList<StringValue> CreateVariableItemList(IList<string> checkedItems = null) {
     128      if (checkedItems == null) checkedItems = new string[0];
    129129      ICheckedItemList<StringValue> itemList = new CheckedItemList<StringValue>();
    130130      foreach (string name in PreprocessingData.GetDoubleVariableNames()) {
    131131        var n = new StringValue(name);
    132         itemList.Add(n, (checkedItems == null) ? true : checkedItems.Contains(name));
     132        itemList.Add(n, checkedItems.Contains(name));
    133133      }
    134134      return new ReadOnlyCheckedItemList<StringValue>(itemList);
Note: See TracChangeset for help on using the changeset viewer.