Changeset 14725 for branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing/3.4/Content/ScatterPlotContent.cs
- Timestamp:
- 03/07/17 16:55:03 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing/3.4/Content/ScatterPlotContent.cs
r14724 r14725 30 30 31 31 public abstract class ScatterPlotContent : PreprocessingChartContent { 32 public string GroupingVariable { get; set; } 33 32 34 protected ScatterPlotContent(IFilteredPreprocessingData preprocessingData) 33 35 : base(preprocessingData) { … … 38 40 } 39 41 40 public ScatterPlot CreateScatterPlot(string variableNameX, string variableNameY, string variableNameGroup = "-") {42 public static ScatterPlot CreateScatterPlot(IFilteredPreprocessingData preprocessingData, string variableNameX, string variableNameY, string variableNameGroup = "-") { 41 43 ScatterPlot scatterPlot = new ScatterPlot(); 42 44 43 IList<double> xValues = PreprocessingData.GetValues<double>(PreprocessingData.GetColumnIndex(variableNameX));44 IList<double> yValues = PreprocessingData.GetValues<double>(PreprocessingData.GetColumnIndex(variableNameY));45 IList<double> xValues = preprocessingData.GetValues<double>(preprocessingData.GetColumnIndex(variableNameX)); 46 IList<double> yValues = preprocessingData.GetValues<double>(preprocessingData.GetColumnIndex(variableNameY)); 45 47 46 48 var points = xValues.Zip(yValues, (x, y) => new Point2D<double>(x, y)).ToList(); … … 77 79 78 80 //Grouping 79 int groupVariableIndex = PreprocessingData.GetColumnIndex(variableNameGroup);81 int groupVariableIndex = preprocessingData.GetColumnIndex(variableNameGroup); 80 82 var groupingValues = Enumerable.Empty<string>(); 81 83 82 if ( PreprocessingData.VariableHasType<double>(groupVariableIndex)) {83 groupingValues = PreprocessingData.GetValues<double>(groupVariableIndex).Select(x => x.ToString());84 } else if ( PreprocessingData.VariableHasType<string>(groupVariableIndex)) {85 groupingValues = PreprocessingData.GetValues<string>(groupVariableIndex);86 } else if ( PreprocessingData.VariableHasType<DateTime>(groupVariableIndex)) {87 groupingValues = PreprocessingData.GetValues<DateTime>(groupVariableIndex).Select(x => x.ToString());84 if (preprocessingData.VariableHasType<double>(groupVariableIndex)) { 85 groupingValues = preprocessingData.GetValues<double>(groupVariableIndex).Select(x => x.ToString()); 86 } else if (preprocessingData.VariableHasType<string>(groupVariableIndex)) { 87 groupingValues = preprocessingData.GetValues<string>(groupVariableIndex); 88 } else if (preprocessingData.VariableHasType<DateTime>(groupVariableIndex)) { 89 groupingValues = preprocessingData.GetValues<DateTime>(groupVariableIndex).Select(x => x.ToString()); 88 90 } 89 91 var groups = groupingValues.Zip(validPoints, Tuple.Create).GroupBy(t => t.Item1, t => t.Item2);
Note: See TracChangeset
for help on using the changeset viewer.