Changeset 10972
- Timestamp:
- 06/11/14 11:39:24 (10 years ago)
- Location:
- branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingChartView.cs
r10952 r10972 48 48 49 49 private const string DEFAULT_CHART_TITLE = "Chart"; 50 private const int FIXED_CHART_SIZE = 300; 51 private const int MAX_TABLE_ROWS = 3; 50 52 51 53 public IEnumerable<double> Classification { get; set; } … … 57 59 } 58 60 61 //Variable selection changed 62 //Add or remove data row 59 63 private void CheckedItemsChanged(object sender, CollectionItemsChangedEventArgs<IndexedItem<StringValue>> checkedItems) { 60 64 foreach (IndexedItem<StringValue> item in checkedItems.Items) { … … 71 75 DataRow selectedRow = GetSelectedDataRow(variableName); 72 76 dataTable.Rows.Add(row); 73 PreprocessingDataTable d = new PreprocessingDataTable(variableName); 74 d.Rows.Add(row); 75 dataTablePerVariable.Add(d); 77 78 PreprocessingDataTable pdt = new PreprocessingDataTable(variableName); 79 pdt.Rows.Add(row); 80 dataTablePerVariable.Add(pdt); 81 82 //update selection 76 83 if (selectedRow != null) 77 84 { 78 85 dataTable.SelectedRows.Add(selectedRow); 79 d.SelectedRows.Add(selectedRow);86 pdt.SelectedRows.Add(selectedRow); 80 87 } 81 88 } 82 89 } 83 90 91 // update chart if not in all in one mode 84 92 if (Content != null && !Content.AllInOneMode) 85 93 GenerateChart(); … … 120 128 } 121 129 checkedItemList.Content = Content.VariableItemList; 130 131 //Create data tables and data rows 122 132 dataRows = logic.CreateAllDataRows(chartType); 123 124 133 dataTable = new PreprocessingDataTable(chartTitle); 125 134 dataTablePerVariable = new List<PreprocessingDataTable>(); … … 261 270 262 271 ClearTableLayout(); 263 264 272 if (Content.AllInOneMode) 265 273 { … … 289 297 } 290 298 299 private int GetNrOfMultiChartColumns(int itemCount) { 300 int columns = 0; 301 if (itemCount <= 2) 302 columns = 1; 303 else if (itemCount <= 6) 304 columns = 2; 305 else 306 columns = 3; 307 return columns; 308 } 309 310 private int GetNrOfMultiChartRows(int itemCount, int columns) { 311 int rows = 0; 312 if (columns == 3) 313 rows = (itemCount + 2) / columns; 314 else if (columns == 2) 315 rows = (itemCount + 1) / columns; 316 else 317 rows = itemCount / columns; 318 return rows; 319 } 320 321 291 322 private void GenerateMultiChartLayout() { 292 323 int checkedItemsCnt = 0; … … 294 325 checkedItemsCnt++; 295 326 296 int rows = 0;297 int columns = 0;298 299 327 // set columns and rows based on number of items 300 if (checkedItemsCnt <= 2) 301 columns = 1; 302 else if (checkedItemsCnt <= 6) 303 columns = 2; 304 else 305 columns = 3; 306 307 if (columns == 3) 308 rows = (checkedItemsCnt + 2) / columns; 309 else if (columns == 2) 310 rows = (checkedItemsCnt + 1) / columns; 311 else 312 rows = checkedItemsCnt / columns; 313 314 //Now we will generate the table, setting up the row and column counts first 328 int columns = GetNrOfMultiChartColumns(checkedItemsCnt); 329 int rows = GetNrOfMultiChartRows(checkedItemsCnt, columns); 330 315 331 tableLayoutPanel.ColumnCount = columns; 316 332 tableLayoutPanel.RowCount = rows; … … 319 335 for (int x = 0; x < columns; x++) { 320 336 321 if (rows <= 3)337 if (rows <= MAX_TABLE_ROWS) 322 338 tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100 / columns)); 323 339 else … … 328 344 if (x == 0) { 329 345 // fixed chart size when there are more than 3 tables 330 if (rows > 3)331 tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 300));346 if (rows > MAX_TABLE_ROWS) 347 tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, FIXED_CHART_SIZE)); 332 348 else 333 349 tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100 / rows)); 334 350 } 335 351 336 PreprocessingDataTableView dataView = new PreprocessingDataTableView();337 dataView.Classification = Classification;338 352 enumerator.MoveNext(); 339 353 PreprocessingDataTable d = enumerator.Current; 340 if (d == null) { 341 // dummy panel for empty field 342 Panel p = new Panel(); 343 p.Dock = DockStyle.Fill; 344 tableLayoutPanel.Controls.Add(p, y, x); 345 } else { 346 dataView.Content = d; 347 dataView.Dock = DockStyle.Fill; 348 tableLayoutPanel.Controls.Add(dataView, y, x); 349 } 354 AddDataTableToTableLayout(d, x, y); 355 350 356 } 357 } 358 } 359 360 private void AddDataTableToTableLayout(PreprocessingDataTable dataTable, int x, int y) { 361 PreprocessingDataTableView dataView = new PreprocessingDataTableView(); 362 dataView.Classification = Classification; 363 364 if (dataTable == null) { 365 // dummy panel for empty field 366 Panel p = new Panel(); 367 p.Dock = DockStyle.Fill; 368 tableLayoutPanel.Controls.Add(p, y, x); 369 } else { 370 dataView.Content = dataTable; 371 dataView.Dock = DockStyle.Fill; 372 tableLayoutPanel.Controls.Add(dataView, y, x); 351 373 } 352 374 } … … 364 386 } 365 387 366 private void radioButton1_CheckedChanged(object sender, EventArgs e) {367 if (Content.AllInOneMode == false)368 Content.AllInOneMode = true;369 else370 Content.AllInOneMode = false;371 GenerateChart();372 }373 374 375 388 } 376 389 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/SingleScatterPlotView.cs
r10952 r10972 36 36 37 37 IEnumerable<string> variables = logic.GetVariableNames(); 38 39 // add variables to combo boxes 38 40 comboBoxXVariable.Items.Clear(); 39 41 comboBoxYVariable.Items.Clear(); 40 41 42 comboBoxXVariable.Items.AddRange(variables.ToArray()); 42 43 comboBoxYVariable.Items.AddRange(variables.ToArray()); … … 54 55 } 55 56 } 56 57 57 } 58 58 … … 71 71 private void UpdateScatterPlot() { 72 72 if (comboBoxXVariable.SelectedItem != null && comboBoxYVariable.SelectedItem != null) { 73 //get scatter plot with selected x and y variable 73 74 ScatterPlot scatterPlot = logic.CreateScatterPlot((string)comboBoxXVariable.SelectedItem, (string)comboBoxYVariable.SelectedItem); 74 75 scatterPlotView.Content = scatterPlot;
Note: See TracChangeset
for help on using the changeset viewer.