Changeset 10369 for branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Views/StatisticsView.cs
- Timestamp:
- 01/22/14 14:33:36 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Views/StatisticsView.cs
r10320 r10369 1 using System.Windows.Forms; 1 using System; 2 using System.Collections.Generic; 3 using System.Windows.Forms; 2 4 using HeuristicLab.Core.Views; 3 5 using HeuristicLab.MainForm; … … 9 11 [Content(typeof(StatisticsContent), false)] 10 12 public partial class StatisticsView : ItemView { 13 14 private List<List<string>> columnsRowsMatrix; 15 private readonly int COLUMNS = 5; 11 16 12 17 public new StatisticsContent Content { … … 21 26 protected override void OnContentChanged() { 22 27 base.OnContentChanged(); 23 if (Content != null) { 24 var logic = Content.StatisticsLogic; 25 txtRows.Text = logic.GetRowCount().ToString(); 26 txtColumns.Text = logic.GetColumnCount().ToString(); 27 txtNumericColumns.Text = logic.GetNumericColumnCount().ToString(); 28 txtNominalColumns.Text = logic.GetNominalColumnCount().ToString(); 29 txtMissingValuesTotal.Text = logic.GetMissingValueCount().ToString(); 28 if (Content == null) { 29 txtRows.Text = ""; 30 txtColumns.Text = ""; 31 txtNumericColumns.Text = ""; 32 txtNominalColumns.Text = ""; 33 txtMissingValuesTotal.Text = ""; 34 dataGridView.Columns.Clear(); 35 } else { 36 UpdateData(); 37 } 38 } 39 private void UpdateData() { 40 var statisticsLogic = Content.StatisticsLogic; 41 var dataGridLogic = Content.DataDridLogic; 42 txtRows.Text = statisticsLogic.GetRowCount().ToString(); 43 txtColumns.Text = statisticsLogic.GetColumnCount().ToString(); 44 txtNumericColumns.Text = statisticsLogic.GetNumericColumnCount().ToString(); 45 txtNominalColumns.Text = statisticsLogic.GetNominalColumnCount().ToString(); 46 txtMissingValuesTotal.Text = statisticsLogic.GetMissingValueCount().ToString(); 47 48 DataGridViewColumn[] columns = new DataGridViewColumn[COLUMNS]; 49 50 columnsRowsMatrix = new List<List<string>>(); 51 52 53 for (int i = 0; i < Content.DataDridLogic.Columns; ++i) { 54 var column = new DataGridViewTextBoxColumn(); 55 column.FillWeight = 1; 56 columns[i] = column; 57 58 List<string> list; 59 if (statisticsLogic.IsType<double>(i)) { 60 list = GetDoubleColumns(i); 61 } else if (statisticsLogic.IsType<string>(i)) { 62 list = GetStringColumns(i); 63 } else if (statisticsLogic.IsType<DateTime>(i)) { 64 list = GetDateTimeColumns(i); 65 } else { 66 list = new List<string>(); 67 } 68 columnsRowsMatrix.Add(list); 69 } 70 71 dataGridView.Columns.Clear(); 72 dataGridView.Columns.AddRange(columns); 73 dataGridView.RowCount = columnsRowsMatrix[0].Count; 74 75 } 76 77 private List<string> GetDoubleColumns(int columnIndex) { 78 var logic = Content.StatisticsLogic; 79 return new List<string> { 80 //logic.GetColumnTypeAsString(columnIndex), 81 //logic.GetMissingValueCount(columnIndex).tostring(), 82 //logic.GetMin<double>(columnIndex), 83 //logic.GetMax<double>(columnIndex), 84 //logic.getmedian(columnIndex), 85 //logic.getaverage(columnIndex), 86 //logic.-(columnIndex), 87 }; 88 } 89 90 private List<string> GetStringColumns(int columnIndex) { 91 return null; 92 } 93 private List<string> GetDateTimeColumns(int columndIndex) { 94 return null; 95 } 96 97 private List<string> GetDoubleColums(int i) { 98 throw new NotImplementedException(); 99 } 100 101 private void dataGridView_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e) { 102 if (Content != null && e.RowIndex < columnsRowsMatrix.Count && e.ColumnIndex < Content.DataDridLogic.Columns) { 103 30 104 } 31 105 }
Note: See TracChangeset
for help on using the changeset viewer.