- Timestamp:
- 06/11/14 15:06:24 (10 years ago)
- Location:
- branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/DataPreprocessingView.cs
r10990 r10992 49 49 var statisticsLogic = new StatisticsLogic(data, searchLogic); 50 50 var manipulationLogic = new ManipulationLogic(data, searchLogic, statisticsLogic, dataGridLogic); 51 var chartLogic = new ChartLogic(data);52 51 //var correlationMatrixLogic = new ChartLogic(data); 53 52 var filterLogic = new FilterLogic(data); … … 59 58 new StatisticsContent(statisticsLogic), 60 59 61 new LineChartContent( chartLogic),62 new HistogramContent( chartLogic),63 new ScatterPlotContent( Content),60 new LineChartContent(data), 61 new HistogramContent(data), 62 new ScatterPlotContent(data), 64 63 new CorrelationMatrixContent(Content), 65 64 new DataCompletenessChartContent(dataGridLogic, searchLogic), -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/HistogramView.cs
r10942 r10992 18 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 19 */ 20 #endregion 20 #endregion 21 21 using System; 22 22 using System.Windows.Forms; … … 40 40 base.OnContentChanged(); 41 41 if (Content != null) { 42 logic = Content.ChartLogic;43 42 44 43 classifierComboBox.Items.Clear(); 45 44 classifierComboBox.Items.Add("None"); 46 45 47 foreach (string var in logic.GetVariableNamesForHistogramClassification()) {46 foreach (string var in Content.GetVariableNamesForHistogramClassification()) { 48 47 classifierComboBox.Items.Add(var); 49 48 } … … 66 65 67 66 if (classifierComboBox.SelectedIndex != 0) { 68 Classification = logic.GetVariableValues(classifierComboBox.SelectedItem.ToString()); 67 int columndIndex = Content.PreprocessingData.GetColumnIndex(classifierComboBox.SelectedItem.ToString()); 68 Classification = Content.PreprocessingData.GetValues<double>(columndIndex); 69 69 } else { 70 70 Classification = null; -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingChartView.cs
r10987 r10992 24 24 using System.Windows.Forms; 25 25 using HeuristicLab.Analysis; 26 using HeuristicLab.Analysis.Views;27 26 using HeuristicLab.Collections; 28 using HeuristicLab.Core;29 27 using HeuristicLab.Core.Views; 30 28 using HeuristicLab.Data; … … 45 43 protected DataRowVisualProperties.DataRowChartType chartType; 46 44 protected string chartTitle; 47 protected IChartLogic logic;48 45 49 46 private const string DEFAULT_CHART_TITLE = "Chart"; 50 47 private const int FIXED_CHART_SIZE = 300; 51 private const int MAX_TABLE_ AUTO_SIZE_ROWS = 3;48 private const int MAX_TABLE_ROWS = 3; 52 49 53 50 public IEnumerable<double> Classification { get; set; } … … 70 67 dataTable.SelectedRows.Remove(variableName); 71 68 dataTablePerVariable.Remove(dataTablePerVariable.Find(x => (x.Name == variableName))); 72 //variable isnt't displayed -> add69 //variable isnt't displayed -> add 73 70 } else { 74 71 DataRow row = GetDataRow(variableName); … … 81 78 82 79 //update selection 83 if (selectedRow != null) 84 { 80 if (selectedRow != null) { 85 81 dataTable.SelectedRows.Add(selectedRow); 86 82 pdt.SelectedRows.Add(selectedRow); 83 } 87 84 } 88 }89 85 } 90 86 … … 106 102 protected override void RegisterContentEvents() { 107 103 base.RegisterContentEvents(); 108 Content. ChartLogic.Changed += PreprocessingData_Changed;109 Content. ChartLogic.SelectionChanged += PreprocessingData_SelctionChanged;104 Content.PreprocessingData.Changed += PreprocessingData_Changed; 105 Content.PreprocessingData.SelectionChanged += PreprocessingData_SelctionChanged; 110 106 111 107 } … … 113 109 protected override void DeregisterContentEvents() { 114 110 base.DeregisterContentEvents(); 115 Content. ChartLogic.Changed -= PreprocessingData_Changed;116 Content. ChartLogic.SelectionChanged -= PreprocessingData_SelctionChanged;111 Content.PreprocessingData.Changed -= PreprocessingData_Changed; 112 Content.PreprocessingData.SelectionChanged -= PreprocessingData_SelctionChanged; 117 113 } 118 114 … … 123 119 124 120 private void InitData() { 125 if (Content.VariableItemList == null) 126 { 127 Content.VariableItemList = logic.CreateVariableItemList(); 121 if (Content.VariableItemList == null) { 122 Content.VariableItemList = Content.CreateVariableItemList(); 128 123 } 129 124 checkedItemList.Content = Content.VariableItemList; 130 125 131 126 //Create data tables and data rows 132 dataRows = logic.CreateAllDataRows(chartType);127 dataRows = Content.CreateAllDataRows(chartType); 133 128 dataTable = new PreprocessingDataTable(chartTitle); 134 129 dataTablePerVariable = new List<PreprocessingDataTable>(); 135 130 136 131 //add data rows to data tables according to checked item list 137 foreach (var checkedItem in Content.VariableItemList.CheckedItems) 138 { 132 foreach (var checkedItem in Content.VariableItemList.CheckedItems) { 139 133 string variableName = Content.VariableItemList[checkedItem.Index].Value; 140 134 PreprocessingDataTable d = new PreprocessingDataTable(variableName); … … 155 149 156 150 //update data table selection 157 selectedDataRows = logic.CreateAllSelectedDataRows(chartType);151 selectedDataRows = Content.CreateAllSelectedDataRows(chartType); 158 152 dataTable.SelectedRows.Clear(); 159 153 dataTable.SelectedRows.AddRange(selectedDataRows); … … 188 182 base.OnContentChanged(); 189 183 if (Content != null) { 190 logic = Content.ChartLogic;191 184 InitData(); 192 185 Content.VariableItemList.CheckedItemsChanged += CheckedItemsChanged; … … 199 192 switch (e.Type) { 200 193 case DataPreprocessingChangedEventType.DeleteColumn: 201 RemoveVariable( logic.GetVariableNameByIndex(e.Column));194 RemoveVariable(Content.PreprocessingData.GetVariableName(e.Column)); 202 195 break; 203 196 case DataPreprocessingChangedEventType.AddColumn: 204 AddVariable( logic.GetVariableNameByIndex(e.Column));197 AddVariable(Content.PreprocessingData.GetVariableName(e.Column)); 205 198 break; 206 199 case DataPreprocessingChangedEventType.ChangeColumn: 207 200 case DataPreprocessingChangedEventType.ChangeItem: 208 UpdateDataForVariable( logic.GetVariableNameByIndex(e.Column));201 UpdateDataForVariable(Content.PreprocessingData.GetVariableName(e.Column)); 209 202 break; 210 203 case DataPreprocessingChangedEventType.DeleteRow: … … 212 205 case DataPreprocessingChangedEventType.Any: 213 206 default: 214 207 //TODO: test with transform 215 208 InitData(); 216 209 GenerateChart(); … … 224 217 225 218 private void UpdateDataForVariable(string variableName) { 226 DataRow newRow = logic.CreateDataRow(variableName, chartType);219 DataRow newRow = Content.CreateDataRow(variableName, chartType); 227 220 dataTable.Rows.Remove(variableName); 228 221 dataTable.Rows.Add(newRow); … … 236 229 // add variable to data table and item list 237 230 private void AddVariable(string name) { 238 DataRow row = logic.CreateDataRow(name, chartType);231 DataRow row = Content.CreateDataRow(name, chartType); 239 232 dataTable.Rows.Add(row); 240 233 PreprocessingDataTable d = new PreprocessingDataTable(name); … … 259 252 260 253 private StringValue FindVariableItemList(string name) { 261 foreach (StringValue stringValue in Content.VariableItemList) 262 { 254 foreach (StringValue stringValue in Content.VariableItemList) { 263 255 if (stringValue.Value == name) 264 256 return stringValue; … … 270 262 271 263 ClearTableLayout(); 272 if (Content.AllInOneMode) 273 { 264 if (Content.AllInOneMode) { 274 265 GenerateSingleChartLayout(); 275 266 } else … … 328 319 int columns = GetNrOfMultiChartColumns(checkedItemsCnt); 329 320 int rows = GetNrOfMultiChartRows(checkedItemsCnt, columns); 330 tableLayoutPanel.VerticalScroll.Enabled = true; 331 321 332 322 tableLayoutPanel.ColumnCount = columns; 333 323 tableLayoutPanel.RowCount = rows; … … 336 326 for (int x = 0; x < columns; x++) { 337 327 338 if (rows <= MAX_TABLE_ AUTO_SIZE_ROWS)328 if (rows <= MAX_TABLE_ROWS) 339 329 tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100 / columns)); 340 330 else … … 345 335 if (x == 0) { 346 336 // fixed chart size when there are more than 3 tables 347 if (rows > MAX_TABLE_ AUTO_SIZE_ROWS)337 if (rows > MAX_TABLE_ROWS) 348 338 tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, FIXED_CHART_SIZE)); 349 339 else … … 354 344 PreprocessingDataTable d = enumerator.Current; 355 345 AddDataTableToTableLayout(d, x, y); 356 346 357 347 } 358 348 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.cs
r10987 r10992 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.ComponentModel;4 3 using System.Drawing; 5 4 using System.Linq; 6 using System.Text;7 5 using System.Windows.Forms; 8 6 using HeuristicLab.Analysis; 9 using HeuristicLab.Analysis.Views;10 using HeuristicLab.Collections;11 7 using HeuristicLab.Common; 12 using HeuristicLab.Core;13 8 using HeuristicLab.Core.Views; 14 using HeuristicLab.Data;15 9 using HeuristicLab.DataPreprocessing.Implementations; 16 10 using HeuristicLab.MainForm; … … 47 41 private void addHeaderToTableLayoutPanels() { 48 42 49 List<string> variables = Content. GetVariableNames().ToList();43 List<string> variables = Content.PreprocessingData.GetDoubleVariableNames().ToList(); 50 44 51 45 for (int i = 1; i < variables.Count + 1; i++) { … … 66 60 } 67 61 68 private void GenerateMultiLayout() 69 { 70 List<string> variables = Content.GetVariableNames().ToList(); 62 private void GenerateMultiLayout() { 63 List<string> variables = Content.PreprocessingData.GetDoubleVariableNames().ToList(); 71 64 72 65 tableLayoutPanel.Controls.Clear(); … … 76 69 77 70 //Set row and column count 78 tableLayoutPanel.ColumnCount = variables.Count +1;79 tableLayoutPanel.RowCount = variables.Count +1;71 tableLayoutPanel.ColumnCount = variables.Count + 1; 72 tableLayoutPanel.RowCount = variables.Count + 1; 80 73 81 74 tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, HEADER_WIDTH)); 82 75 tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, HEADER_HEIGHT)); 83 76 // set column and row layout 84 for (int x = 0; x < variables.Count; x++) 85 { 77 for (int x = 0; x < variables.Count; x++) { 86 78 // auto size 87 79 if (variables.Count <= MAX_AUTO_SIZE_ELEMENTS) { 88 80 tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, (tableLayoutPanel.Width - HEADER_WIDTH) / variables.Count)); 89 81 tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, (tableLayoutPanel.Height - HEADER_HEIGHT) / variables.Count)); 90 } 91 // fixed size82 } 83 // fixed size 92 84 else { 93 85 tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, FIXED_CHART_WIDTH)); … … 98 90 addHeaderToTableLayoutPanels(); 99 91 addChartsToTableLayoutPanel(); 100 92 101 93 } 102 94 103 95 private void addChartsToTableLayoutPanel() { 104 96 105 List<string> variables = Content. GetVariableNames().ToList();97 List<string> variables = Content.PreprocessingData.GetDoubleVariableNames().ToList(); 106 98 107 99 //set scatter plots and histograms … … 119 111 tableLayoutPanel.Controls.Add(pcv, y, x); 120 112 } 121 //scatter plot113 //scatter plot 122 114 else { 123 115 ScatterPlot scatterPlot = Content.CreateScatterPlot(variables[x - 1], variables[y - 1]); … … 147 139 // only one data row should be in scatter plot 148 140 if (scatterPlot.Rows.Count == 1) { 149 string[] variables = scatterPlot.Rows.ElementAt(0).Name.Split(new string[] {" - "},StringSplitOptions.None); // extract variable names from string141 string[] variables = scatterPlot.Rows.ElementAt(0).Name.Split(new string[] { " - " }, StringSplitOptions.None); // extract variable names from string 150 142 scatterContent.SelectedXVariable = variables[0]; 151 143 scatterContent.SelectedYVariable = variables[1]; … … 161 153 162 154 // set only variable name checked 163 foreach(var checkedItem in histoContent.VariableItemList) 164 { 165 if(checkedItem.Value == variableName) 166 histoContent.VariableItemList.SetItemCheckedState(checkedItem,true); 155 foreach (var checkedItem in histoContent.VariableItemList) { 156 if (checkedItem.Value == variableName) 157 histoContent.VariableItemList.SetItemCheckedState(checkedItem, true); 167 158 else 168 histoContent.VariableItemList.SetItemCheckedState(checkedItem, false);169 159 histoContent.VariableItemList.SetItemCheckedState(checkedItem, false); 160 170 161 } 171 162 } … … 174 165 //open histogram in new tab with new content when double clicked 175 166 private void HistogramDoubleClick(object sender, EventArgs e) { 176 //PreprocessingDataTableView pcv = (PreprocessingDataTableView)sender;177 //HistogramContent histoContent = new HistogramContent(Content,); // create new content178 //histoContent.VariableItemList = logic.CreateVariableItemList();179 //PreprocessingDataTable dataTable = pcv.Content;180 //setVariableItemListFromDataTable(histoContent, dataTable);167 PreprocessingDataTableView pcv = (PreprocessingDataTableView)sender; 168 HistogramContent histoContent = new HistogramContent(Content.PreprocessingData); // create new content 169 histoContent.VariableItemList = Content.CreateVariableItemList(); 170 PreprocessingDataTable dataTable = pcv.Content; 171 setVariableItemListFromDataTable(histoContent, dataTable); 181 172 182 //MainFormManager.MainForm.ShowContent(histoContent, typeof(HistogramView)); // open in new tab173 MainFormManager.MainForm.ShowContent(histoContent, typeof(HistogramView)); // open in new tab 183 174 } 184 175 185 176 186 177 } 187 178 188 179 189 180 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotSingleView.cs
r10987 r10992 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.ComponentModel;4 using System.Drawing;5 using System.Data;6 3 using System.Linq; 7 using System.Text;8 4 using System.Windows.Forms; 9 5 using HeuristicLab.Analysis; 10 using HeuristicLab.Analysis.Views;11 using HeuristicLab.Collections;12 using HeuristicLab.Core;13 6 using HeuristicLab.Core.Views; 14 using HeuristicLab.Data;15 using HeuristicLab.DataPreprocessing.Implementations;16 7 using HeuristicLab.MainForm; 17 8 … … 33 24 public void InitData() { 34 25 35 IEnumerable<string> variables = Content. GetVariableNames();26 IEnumerable<string> variables = Content.PreprocessingData.GetDoubleVariableNames(); 36 27 37 28 // add variables to combo boxes … … 80 71 } 81 72 82 73 83 74 }
Note: See TracChangeset
for help on using the changeset viewer.