- Timestamp:
- 01/18/17 11:25:43 (8 years ago)
- Location:
- branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing/3.4/Content
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing/3.4/Content/HistogramContent.cs
r14579 r14581 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 22 using System.Drawing; 25 using System.Linq;26 23 using HeuristicLab.Common; 27 24 using HeuristicLab.Core; … … 30 27 [Item("Histogram", "Represents the histogram grid.")] 31 28 public class HistogramContent : PreprocessingChartContent { 32 33 29 public static new Image StaticItemImage { 34 30 get { return HeuristicLab.Common.Resources.VSImageLibrary.Statistics; } 35 31 } 36 37 private const int MAX_DISTINCT_VALUES_FOR_GROUPING = 20;38 32 39 33 public string GroupingVariableName { get; set; } … … 55 49 } 56 50 57 public IEnumerable<string> GetVariableNamesForGrouping() {58 var variableNames = new List<string>();59 51 60 for (int i = 0; i < PreprocessingData.Columns; ++i) {61 int distinctValues = int.MaxValue;62 if (PreprocessingData.VariableHasType<double>(i))63 distinctValues = PreprocessingData.GetValues<double>(i).GroupBy(x => x).Count();64 else if (PreprocessingData.VariableHasType<string>(i))65 distinctValues = PreprocessingData.GetValues<string>(i).GroupBy(x => x).Count();66 else if (PreprocessingData.VariableHasType<DateTime>(i))67 distinctValues = PreprocessingData.GetValues<DateTime>(i).GroupBy(x => x).Count();68 69 if (distinctValues <= MAX_DISTINCT_VALUES_FOR_GROUPING)70 variableNames.Add(PreprocessingData.GetVariableName(i));71 }72 return variableNames;73 }74 52 } 75 53 } -
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing/3.4/Content/PreprocessingChartContent.cs
r14511 r14581 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.Drawing; 25 using System.Linq; 24 26 using HeuristicLab.Analysis; 25 27 using HeuristicLab.Common; 28 using HeuristicLab.Common.Resources; 26 29 using HeuristicLab.Core; 27 30 using HeuristicLab.Data; … … 31 34 public class PreprocessingChartContent : Item, IViewShortcut { 32 35 public static new Image StaticItemImage { 33 get { return HeuristicLab.Common.Resources.VSImageLibrary.PieChart; }36 get { return VSImageLibrary.PieChart; } 34 37 } 35 38 … … 38 41 get { 39 42 if (variableItemList == null) 40 variableItemList = CreateVariableItemList( );43 variableItemList = CreateVariableItemList(PreprocessingData); 41 44 return this.variableItemList; 42 45 } 43 //set { this.variableItemList = value; }44 46 } 45 47 46 48 public IFilteredPreprocessingData PreprocessingData { get; private set; } 49 public event DataPreprocessingChangedEventHandler Changed { 50 add { PreprocessingData.Changed += value; } 51 remove { PreprocessingData.Changed -= value; } 52 } 47 53 48 54 public PreprocessingChartContent(IFilteredPreprocessingData preprocessingData) { … … 66 72 } 67 73 68 69 70 71 public ICheckedItemList<StringValue> CreateVariableItemList() { 74 private static ICheckedItemList<StringValue> CreateVariableItemList(IPreprocessingData preprocessingData) { 72 75 ICheckedItemList<StringValue> itemList = new CheckedItemList<StringValue>(); 73 foreach (string name in PreprocessingData.GetDoubleVariableNames()) {76 foreach (string name in preprocessingData.GetDoubleVariableNames()) { 74 77 var n = new StringValue(name); 75 bool isInputTarget = PreprocessingData.InputVariables.Contains(name) || PreprocessingData.TargetVariable == name;78 bool isInputTarget = preprocessingData.InputVariables.Contains(name) || preprocessingData.TargetVariable == name; 76 79 itemList.Add(n, isInputTarget); 77 80 } 78 81 return new ReadOnlyCheckedItemList<StringValue>(itemList); 79 82 } 80 81 public event DataPreprocessingChangedEventHandler Changed {82 add { PreprocessingData.Changed += value; }83 remove { PreprocessingData.Changed -= value; }84 }85 86 83 } 87 84 }
Note: See TracChangeset
for help on using the changeset viewer.