Changeset 14725 for branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing/3.4/Content/PreprocessingChartContent.cs
- Timestamp:
- 03/07/17 16:55:03 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing/3.4/Content/PreprocessingChartContent.cs
r14581 r14725 66 66 67 67 public DataRow CreateDataRow(string variableName, DataRowVisualProperties.DataRowChartType chartType) { 68 IList<double> values = PreprocessingData.GetValues<double>(PreprocessingData.GetColumnIndex(variableName)); 68 return CreateDataRow(PreprocessingData, variableName, chartType); 69 } 70 71 public static DataRow CreateDataRow(IFilteredPreprocessingData preprocessingData, string variableName, DataRowVisualProperties.DataRowChartType chartType) { 72 IList<double> values = preprocessingData.GetValues<double>(preprocessingData.GetColumnIndex(variableName)); 69 73 DataRow row = new DataRow(variableName, "", values); 70 74 row.VisualProperties.ChartType = chartType; … … 81 85 return new ReadOnlyCheckedItemList<StringValue>(itemList); 82 86 } 87 88 private const int MAX_DISTINCT_VALUES_FOR_GROUPING = 20; 89 public static IEnumerable<string> GetVariableNamesForGrouping(IPreprocessingData preprocessingData) { 90 var variableNames = new List<string>(); 91 92 for (int i = 0; i < preprocessingData.Columns; ++i) { 93 int distinctValues = Int32.MaxValue; 94 if (preprocessingData.VariableHasType<double>(i)) 95 distinctValues = preprocessingData.GetValues<double>(i).GroupBy(x => x).Count(); 96 else if (preprocessingData.VariableHasType<string>(i)) 97 distinctValues = preprocessingData.GetValues<string>(i).GroupBy(x => x).Count(); 98 else if (preprocessingData.VariableHasType<DateTime>(i)) 99 distinctValues = preprocessingData.GetValues<DateTime>(i).GroupBy(x => x).Count(); 100 101 if (distinctValues <= MAX_DISTINCT_VALUES_FOR_GROUPING) 102 variableNames.Add(preprocessingData.GetVariableName(i)); 103 } 104 return variableNames; 105 } 83 106 } 84 107 }
Note: See TracChangeset
for help on using the changeset viewer.