Changeset 14581 for branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing/3.4/Content/HistogramContent.cs
- Timestamp:
- 01/18/17 11:25:43 (7 years ago)
- File:
-
- 1 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 }
Note: See TracChangeset
for help on using the changeset viewer.