Changeset 14725 for branches/DataPreprocessing Enhancements
- Timestamp:
- 03/07/17 16:55:03 (8 years ago)
- Location:
- branches/DataPreprocessing Enhancements
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/HistogramView.cs
r14583 r14725 21 21 22 22 using System; 23 using System.Linq;24 23 using HeuristicLab.Analysis; 25 24 using HeuristicLab.MainForm; … … 46 45 47 46 if (Content != null) { 48 foreach (string var in GetVariableNamesForGrouping(Content.PreprocessingData)) {47 foreach (string var in PreprocessingChartContent.GetVariableNamesForGrouping(Content.PreprocessingData)) { 49 48 classifierComboBox.Items.Add(var); 50 49 } … … 55 54 56 55 protected override DataTable CreateDataTable(string variableName) { 57 var dataTable = new DataTable(); 58 59 if (string.IsNullOrEmpty(Content.GroupingVariableName)) { 60 var row = Content.CreateDataRow(variableName, DataRowVisualProperties.DataRowChartType.Histogram); 61 dataTable.Rows.Add(row); 62 return dataTable; 63 } 64 65 dataTable.VisualProperties.Title = variableName; 66 67 int variableIndex = Content.PreprocessingData.GetColumnIndex(variableName); 68 var variableValues = Content.PreprocessingData.GetValues<double>(variableIndex); 69 int groupVariableIndex = Content.PreprocessingData.GetColumnIndex(Content.GroupingVariableName); 70 var groupingValues = Enumerable.Empty<string>(); 71 72 if (Content.PreprocessingData.VariableHasType<double>(groupVariableIndex)) { 73 groupingValues = Content.PreprocessingData.GetValues<double>(groupVariableIndex).Select(x => x.ToString()); 74 } else if (Content.PreprocessingData.VariableHasType<string>(groupVariableIndex)) { 75 groupingValues = Content.PreprocessingData.GetValues<string>(groupVariableIndex); 76 } else if (Content.PreprocessingData.VariableHasType<DateTime>(groupVariableIndex)) { 77 groupingValues = Content.PreprocessingData.GetValues<DateTime>(groupVariableIndex).Select(x => x.ToString()); 78 } 79 80 var groups = groupingValues.Zip(variableValues, Tuple.Create).GroupBy(t => t.Item1, t => t.Item2); 81 82 foreach (var group in groups) { 83 var classRow = new DataRow(); 84 classRow.Name = group.Key; 85 classRow.VisualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Histogram; 86 classRow.VisualProperties.Aggregation = (DataRowVisualProperties.DataRowHistogramAggregation)aggregationComboBox.SelectedItem; 87 classRow.Values.AddRange(group); 88 dataTable.Rows.Add(classRow); 89 } 90 return dataTable; 56 var aggregation = (DataRowVisualProperties.DataRowHistogramAggregation)aggregationComboBox.SelectedItem; 57 return HistogramContent.CreateHistogram(Content.PreprocessingData, variableName, Content.GroupingVariableName, aggregation); 91 58 } 92 93 59 94 60 private void classifierComboBox_SelectedIndexChanged(object sender, EventArgs e) { -
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingChartView.cs
r14581 r14725 35 35 [View("Preprocessing Chart View")] 36 36 [Content(typeof(PreprocessingChartContent), false)] 37 public partial class PreprocessingChartView : PreprocessingCheckedVariablesView { 38 private const int MAX_DISTINCT_VALUES_FOR_GROUPING = 20; 37 public partial class PreprocessingChartView : PreprocessingCheckedVariablesView { 39 38 protected Dictionary<string, DataTable> dataTables; 40 39 protected Dictionary<string, DataTableControl> dataTableControls; … … 64 63 GenerateLayout(); 65 64 } 66 }67 68 protected static IEnumerable<string> GetVariableNamesForGrouping(IPreprocessingData preprocessingData) {69 var variableNames = new List<string>();70 71 for (int i = 0; i < preprocessingData.Columns; ++i) {72 int distinctValues = Int32.MaxValue;73 if (preprocessingData.VariableHasType<double>(i))74 distinctValues = preprocessingData.GetValues<double>(i).GroupBy(x => x).Count();75 else if (preprocessingData.VariableHasType<string>(i))76 distinctValues = preprocessingData.GetValues<string>(i).GroupBy(x => x).Count();77 else if (preprocessingData.VariableHasType<DateTime>(i))78 distinctValues = preprocessingData.GetValues<DateTime>(i).GroupBy(x => x).Count();79 80 if (distinctValues <= MAX_DISTINCT_VALUES_FOR_GROUPING)81 variableNames.Add(preprocessingData.GetVariableName(i));82 }83 return variableNames;84 65 } 85 66 -
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.Designer.cs
r14514 r14725 62 62 this.orderLabel = new System.Windows.Forms.Label(); 63 63 this.label4 = new System.Windows.Forms.Label(); 64 this.groupingOptionsBox = new System.Windows.Forms.GroupBox(); 65 this.groupingComboBox = new System.Windows.Forms.ComboBox(); 64 66 ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); 65 67 this.splitContainer.Panel1.SuspendLayout(); … … 75 77 this.regressionGroupBox.SuspendLayout(); 76 78 ((System.ComponentModel.ISupportInitialize)(this.polynomialRegressionOrderNumericUpDown)).BeginInit(); 79 this.groupingOptionsBox.SuspendLayout(); 77 80 this.SuspendLayout(); 78 81 // … … 83 86 // 84 87 this.splitContainer.Panel1.Controls.Add(this.sizeGroupBox); 88 this.splitContainer.Panel1.Controls.Add(this.groupingOptionsBox); 85 89 this.splitContainer.Panel1.Controls.Add(this.regressionGroupBox); 86 90 // … … 195 199 this.sizeGroupBox.Controls.Add(this.widthTrackBar); 196 200 this.sizeGroupBox.Dock = System.Windows.Forms.DockStyle.Bottom; 197 this.sizeGroupBox.Location = new System.Drawing.Point(0, 1 98);201 this.sizeGroupBox.Location = new System.Drawing.Point(0, 154); 198 202 this.sizeGroupBox.Name = "sizeGroupBox"; 199 203 this.sizeGroupBox.Size = new System.Drawing.Size(180, 130); … … 319 323 this.label4.TabIndex = 13; 320 324 this.label4.Text = "Type:"; 325 // 326 // groupingOptionsBox 327 // 328 this.groupingOptionsBox.Controls.Add(this.groupingComboBox); 329 this.groupingOptionsBox.Dock = System.Windows.Forms.DockStyle.Bottom; 330 this.groupingOptionsBox.Location = new System.Drawing.Point(0, 284); 331 this.groupingOptionsBox.Name = "groupingOptionsBox"; 332 this.groupingOptionsBox.Size = new System.Drawing.Size(180, 44); 333 this.groupingOptionsBox.TabIndex = 8; 334 this.groupingOptionsBox.TabStop = false; 335 this.groupingOptionsBox.Text = "Grouping Variable"; 336 // 337 // groupingComboBox 338 // 339 this.groupingComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 340 | System.Windows.Forms.AnchorStyles.Right))); 341 this.groupingComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 342 this.groupingComboBox.FormattingEnabled = true; 343 this.groupingComboBox.Location = new System.Drawing.Point(6, 19); 344 this.groupingComboBox.Name = "groupingComboBox"; 345 this.groupingComboBox.Size = new System.Drawing.Size(169, 21); 346 this.groupingComboBox.TabIndex = 1; 347 this.groupingComboBox.SelectedIndexChanged += new System.EventHandler(this.groupingComboBox_SelectedIndexChanged); 321 348 // 322 349 // ScatterPlotMultiView … … 343 370 this.regressionGroupBox.PerformLayout(); 344 371 ((System.ComponentModel.ISupportInitialize)(this.polynomialRegressionOrderNumericUpDown)).EndInit(); 372 this.groupingOptionsBox.ResumeLayout(false); 345 373 this.ResumeLayout(false); 346 374 … … 366 394 private System.Windows.Forms.Label orderLabel; 367 395 private System.Windows.Forms.Label label4; 396 private System.Windows.Forms.GroupBox groupingOptionsBox; 397 private System.Windows.Forms.ComboBox groupingComboBox; 368 398 } 369 399 } -
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.cs
r14580 r14725 55 55 base.OnContentChanged(); 56 56 if (Content != null) { 57 groupingComboBox.Items.Add(""); 58 foreach (string var in PreprocessingChartContent.GetVariableNamesForGrouping(Content.PreprocessingData)) { 59 groupingComboBox.Items.Add(var); 60 } 61 groupingComboBox.SelectedItem = Content.GroupingVariable; 62 57 63 GenerateCharts(); 58 64 } … … 261 267 if (!bodyCache.ContainsKey(key)) { 262 268 if (rowVariable == colVariable) { // use historgram if x and y variable are equal 263 var dataTable = new DataTable();264 DataRow dataRow = Content.CreateDataRow(rowVariable, DataRowVisualProperties.DataRowChartType.Histogram);265 dataRow.VisualProperties.IsVisibleInLegend = false;266 dataTable.Rows.Add(dataRow); 269 var dataTable = HistogramContent.CreateHistogram(Content.PreprocessingData, rowVariable, (string)groupingComboBox.SelectedItem, DataRowVisualProperties.DataRowHistogramAggregation.Overlapping); 270 foreach (var dataRow in dataTable.Rows) 271 dataRow.VisualProperties.IsVisibleInLegend = false; 272 267 273 var pcv = new DataTableControl { 268 274 Name = key.ToString(), … … 275 281 bodyCache.Add(key, pcv); 276 282 } else { //scatter plot 277 var scatterPlot = Content.CreateScatterPlot(colVariable, rowVariable);283 var scatterPlot = ScatterPlotContent.CreateScatterPlot(Content.PreprocessingData, colVariable, rowVariable, (string)groupingComboBox.SelectedItem); 278 284 var regressionType = (RegressionType)regressionTypeComboBox.SelectedValue; 279 285 int order = (int)polynomialRegressionOrderNumericUpDown.Value; … … 486 492 } 487 493 #endregion 494 495 private void groupingComboBox_SelectedIndexChanged(object sender, EventArgs e) { 496 GenerateCharts(); 497 } 488 498 } 489 499 } -
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotSingleView.Designer.cs
r14724 r14725 144 144 // comboBoxGroup 145 145 // 146 this.comboBoxGroup.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 146 this.comboBoxGroup.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 147 147 | System.Windows.Forms.AnchorStyles.Right))); 148 148 this.comboBoxGroup.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; … … 159 159 // comboBoxYVariable 160 160 // 161 this.comboBoxYVariable.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 161 this.comboBoxYVariable.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 162 162 | System.Windows.Forms.AnchorStyles.Right))); 163 163 this.comboBoxYVariable.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; … … 173 173 // comboBoxXVariable 174 174 // 175 this.comboBoxXVariable.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 175 this.comboBoxXVariable.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 176 176 | System.Windows.Forms.AnchorStyles.Right))); 177 177 this.comboBoxXVariable.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; … … 201 201 // regressionTypeComboBox 202 202 // 203 this.regressionTypeComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 203 this.regressionTypeComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 204 204 | System.Windows.Forms.AnchorStyles.Right))); 205 205 this.regressionTypeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; … … 213 213 // polynomialRegressionOrderNumericUpDown 214 214 // 215 this.polynomialRegressionOrderNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 215 this.polynomialRegressionOrderNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 216 216 | System.Windows.Forms.AnchorStyles.Right))); 217 217 this.polynomialRegressionOrderNumericUpDown.Location = new System.Drawing.Point(51, 47); … … 288 288 // gradientPictureBox 289 289 // 290 this.gradientPictureBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 290 this.gradientPictureBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 291 291 | System.Windows.Forms.AnchorStyles.Left))); 292 292 this.gradientPictureBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; … … 363 363 private System.Windows.Forms.Label gradientMinimumLabel; 364 364 private System.Windows.Forms.Label gradientMaximumLabel; 365 pr otectedSystem.Windows.Forms.PictureBox gradientPictureBox;365 private System.Windows.Forms.PictureBox gradientPictureBox; 366 366 } 367 367 } -
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotSingleView.cs
r14724 r14725 36 36 [Content(typeof(SingleScatterPlotContent), true)] 37 37 public sealed partial class ScatterPlotSingleView : ItemView { 38 private const int MAX_DISTINCT_VALUES_FOR_GROUPING = 20;39 38 private readonly string NoGroupItem = ""; 40 39 … … 74 73 comboBoxYVariable.Items.AddRange(variables.ToArray()); 75 74 comboBoxGroup.Items.Add(NoGroupItem); 76 foreach (string var in GetVariableNamesForGrouping(Content.PreprocessingData)) {75 foreach (string var in PreprocessingChartContent.GetVariableNamesForGrouping(Content.PreprocessingData)) { 77 76 comboBoxGroup.Items.Add(var); 78 77 } 79 comboBoxGroup.SelectedItem = Content. SelectedGroupVariable;78 comboBoxGroup.SelectedItem = Content.GroupingVariable; 80 79 81 80 // use x and y variable from content 82 if (Content.SelectedXVariable != null && Content.SelectedYVariable != null && Content. SelectedGroupVariable != null) {81 if (Content.SelectedXVariable != null && Content.SelectedYVariable != null && Content.GroupingVariable != null) { 83 82 comboBoxXVariable.SelectedItem = Content.SelectedXVariable; 84 83 comboBoxYVariable.SelectedItem = Content.SelectedYVariable; 85 comboBoxGroup.SelectedItem = Content. SelectedGroupVariable;84 comboBoxGroup.SelectedItem = Content.GroupingVariable; 86 85 } else { 87 86 if (variables.Count() >= 2) { … … 100 99 var groupVariable = (string)comboBoxGroup.SelectedItem; 101 100 102 ScatterPlot scatterPlot = Content.CreateScatterPlot(xVariable, yVariable, groupVariable);101 ScatterPlot scatterPlot = ScatterPlotContent.CreateScatterPlot(Content.PreprocessingData, xVariable, yVariable, groupVariable); 103 102 //rows are saved and removed to avoid firing of visual property changed events 104 103 var rows = scatterPlot.Rows.ToList(); … … 124 123 this.Content.SelectedXVariable = (string)comboBoxXVariable.SelectedItem; 125 124 this.Content.SelectedYVariable = (string)comboBoxYVariable.SelectedItem; 126 this.Content. SelectedGroupVariable = (string)comboBoxGroup.SelectedItem;125 this.Content.GroupingVariable = (string)comboBoxGroup.SelectedItem; 127 126 } 128 127 } … … 241 240 return colors[index]; 242 241 } 243 244 private static IEnumerable<string> GetVariableNamesForGrouping(IPreprocessingData preprocessingData) {245 var variableNames = new List<string>();246 247 for (int i = 0; i < preprocessingData.Columns; ++i) {248 int distinctValues = Int32.MaxValue;249 if (preprocessingData.VariableHasType<double>(i))250 distinctValues = preprocessingData.GetValues<double>(i).GroupBy(x => x).Count();251 else if (preprocessingData.VariableHasType<string>(i))252 distinctValues = preprocessingData.GetValues<string>(i).GroupBy(x => x).Count();253 else if (preprocessingData.VariableHasType<DateTime>(i))254 distinctValues = preprocessingData.GetValues<DateTime>(i).GroupBy(x => x).Count();255 256 if (distinctValues <= MAX_DISTINCT_VALUES_FOR_GROUPING)257 variableNames.Add(preprocessingData.GetVariableName(i));258 }259 return variableNames;260 }261 242 } 262 243 } -
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing/3.4/Content/HistogramContent.cs
r14581 r14725 20 20 #endregion 21 21 22 using System; 22 23 using System.Drawing; 24 using System.Linq; 25 using HeuristicLab.Analysis; 23 26 using HeuristicLab.Common; 24 27 using HeuristicLab.Core; … … 49 52 } 50 53 54 public static DataTable CreateHistogram(IFilteredPreprocessingData preprocessingData, string variableName, string groupingVariableName, DataRowVisualProperties.DataRowHistogramAggregation aggregation) { 55 { 56 var dataTable = new DataTable(); 57 58 if (string.IsNullOrEmpty(groupingVariableName)) { 59 var row = PreprocessingChartContent.CreateDataRow(preprocessingData, variableName, DataRowVisualProperties.DataRowChartType.Histogram); 60 dataTable.Rows.Add(row); 61 return dataTable; 62 } 63 64 dataTable.VisualProperties.Title = variableName; 65 66 int variableIndex = preprocessingData.GetColumnIndex(variableName); 67 var variableValues = preprocessingData.GetValues<double>(variableIndex); 68 int groupVariableIndex = preprocessingData.GetColumnIndex(groupingVariableName); 69 var groupingValues = Enumerable.Empty<string>(); 70 71 if (preprocessingData.VariableHasType<double>(groupVariableIndex)) { 72 groupingValues = preprocessingData.GetValues<double>(groupVariableIndex).Select(x => x.ToString()); 73 } else if (preprocessingData.VariableHasType<string>(groupVariableIndex)) { 74 groupingValues = preprocessingData.GetValues<string>(groupVariableIndex); 75 } else if (preprocessingData.VariableHasType<DateTime>(groupVariableIndex)) { 76 groupingValues = preprocessingData.GetValues<DateTime>(groupVariableIndex).Select(x => x.ToString()); 77 } 78 79 var groups = groupingValues.Zip(variableValues, Tuple.Create).GroupBy(t => t.Item1, t => t.Item2); 80 81 foreach (var group in groups) { 82 var classRow = new DataRow(); 83 classRow.Name = group.Key; 84 classRow.VisualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Histogram; 85 classRow.VisualProperties.Aggregation = aggregation; 86 classRow.Values.AddRange(group); 87 dataTable.Rows.Add(classRow); 88 } 89 return dataTable; 90 } 91 } 92 51 93 52 94 } -
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 } -
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); -
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing/3.4/Content/SingleScatterPlotContent.cs
r14467 r14725 31 31 public string SelectedXVariable { get; set; } 32 32 public string SelectedYVariable { get; set; } 33 public string SelectedGroupVariable { get; set; }34 33 35 34 public SingleScatterPlotContent(IFilteredPreprocessingData preprocessingData) … … 41 40 this.SelectedXVariable = content.SelectedXVariable; 42 41 this.SelectedYVariable = content.SelectedYVariable; 43 this. SelectedGroupVariable = content.SelectedGroupVariable;42 this.GroupingVariable = content.GroupingVariable; 44 43 } 45 44
Note: See TracChangeset
for help on using the changeset viewer.