- Timestamp:
- 07/14/16 22:38:23 (8 years ago)
- Location:
- stable
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 13502,13504,13507-13508,13512,13514,13517
- Property svn:mergeinfo changed
-
stable/HeuristicLab.DataPreprocessing.Views
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.DataPreprocessing.Views merged: 13502,13504,13507-13508,13512,13514,13517
- Property svn:mergeinfo changed
-
stable/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotSingleView.cs
r10998 r14075 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 2 23 using System.Collections.Generic; 3 24 using System.Linq; 4 using System.Windows.Forms;5 25 using HeuristicLab.Analysis; 6 26 using HeuristicLab.Core.Views; … … 18 38 } 19 39 20 public ScatterPlotSingleView() 21 { 40 public ScatterPlotSingleView() { 22 41 InitializeComponent(); 23 42 } 24 43 25 44 public void InitData() { 26 27 45 IEnumerable<string> variables = Content.PreprocessingData.GetDoubleVariableNames(); 28 46 … … 30 48 comboBoxXVariable.Items.Clear(); 31 49 comboBoxYVariable.Items.Clear(); 50 comboBoxColor.Items.Clear(); 32 51 comboBoxXVariable.Items.AddRange(variables.ToArray()); 33 52 comboBoxYVariable.Items.AddRange(variables.ToArray()); 53 comboBoxColor.Items.Add("-"); 54 for (int i = 0; i < Content.PreprocessingData.Columns; ++i) { 55 if (Content.PreprocessingData.VariableHasType<double>(i)) { 56 double distinctValueCount = Content.PreprocessingData.GetValues<double>(i).GroupBy(x => x).Count(); 57 if (distinctValueCount <= 20) 58 comboBoxColor.Items.Add(Content.PreprocessingData.GetVariableName(i)); 59 } 60 } 34 61 35 62 // use x and y variable from content 36 if (Content.SelectedXVariable != null && Content.SelectedYVariable != null ) {63 if (Content.SelectedXVariable != null && Content.SelectedYVariable != null && Content.SelectedColorVariable != null) { 37 64 comboBoxXVariable.SelectedItem = Content.SelectedXVariable; 38 65 comboBoxYVariable.SelectedItem = Content.SelectedYVariable; 66 comboBoxColor.SelectedItem = Content.SelectedColorVariable; 39 67 } else { 40 68 if (variables.Count() >= 2) { 41 69 comboBoxXVariable.SelectedIndex = 0; 42 70 comboBoxYVariable.SelectedIndex = 1; 71 comboBoxColor.SelectedIndex = 0; 43 72 UpdateScatterPlot(); 44 45 73 } 46 74 } … … 59 87 60 88 private void UpdateScatterPlot() { 61 if (comboBoxXVariable.SelectedItem != null && comboBoxYVariable.SelectedItem != null ) {89 if (comboBoxXVariable.SelectedItem != null && comboBoxYVariable.SelectedItem != null && comboBoxColor.SelectedItem != null) { 62 90 //get scatter plot with selected x and y variable 63 ScatterPlot scatterPlot = Content.CreateScatterPlot((string)comboBoxXVariable.SelectedItem, (string)comboBoxYVariable.SelectedItem); 91 ScatterPlot scatterPlot = Content.CreateScatterPlot( 92 (string)comboBoxXVariable.SelectedItem, 93 (string)comboBoxYVariable.SelectedItem, 94 (string)comboBoxColor.SelectedItem); 64 95 scatterPlotView.Content = scatterPlot; 65 96 … … 67 98 this.Content.SelectedXVariable = (string)comboBoxXVariable.SelectedItem; 68 99 this.Content.SelectedYVariable = (string)comboBoxYVariable.SelectedItem; 100 this.Content.SelectedColorVariable = (string)comboBoxColor.SelectedItem; 69 101 } 70 102 } 71 72 103 } 73 74 75 104 }
Note: See TracChangeset
for help on using the changeset viewer.