- Timestamp:
- 03/05/14 13:28:31 (11 years ago)
- Location:
- branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/StatisticsLogic.cs
r10532 r10534 92 92 93 93 public T GetMostCommonValue<T>(int columnIndex) { 94 var t = preprocessingData.GetValues<T>(columnIndex); 95 var t2 = t.GroupBy(x => x); 96 var t3 = t2.Select(g => g.Key); 97 94 98 return preprocessingData.GetValues<T>(columnIndex) 95 99 … … 153 157 return "Unknown Type"; 154 158 } 155 156 159 private IEnumerable<double> GetDateTimeAsSeconds(int columnIndex) { 157 160 return preprocessingData.GetValues<DateTime>(columnIndex).Select(x => (double)x.Ticks / TimeSpan.TicksPerSecond); -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IStatisticsLogic.cs
r10381 r10534 27 27 bool IsType<T>(int columnIndex); 28 28 string GetColumnTypeAsString(int columnIndex); 29 29 string GetVariableName(int columnIndex); 30 30 } 31 31 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Views/DataGridContentView.cs
r10533 r10534 1 1 2 using System; 3 using System.Collections.Generic; 4 using System.Linq; 2 5 using System.Windows.Forms; 3 using HeuristicLab. Core.Views;6 using HeuristicLab.Data.Views; 4 7 using HeuristicLab.MainForm; 5 8 using HeuristicLab.MainForm.WindowsForms; 6 using HeuristicLab.Problems.DataAnalysis;7 using HeuristicLab.Data.Views;8 using System.Collections.Generic;9 using System.Linq;10 using System;11 9 12 10 namespace HeuristicLab.DataPreprocessing { -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Views/StatisticsView.Designer.cs
r10367 r10534 130 130 // dataGridView 131 131 // 132 this.dataGridView.AllowUserToAddRows = false; 133 this.dataGridView.AllowUserToDeleteRows = false; 134 this.dataGridView.AllowUserToOrderColumns = true; 135 this.dataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 136 | System.Windows.Forms.AnchorStyles.Left) 137 | System.Windows.Forms.AnchorStyles.Right))); 132 138 this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; 133 139 this.dataGridView.Location = new System.Drawing.Point(5, 117); 134 140 this.dataGridView.Name = "dataGridView"; 135 this.dataGridView.Size = new System.Drawing.Size(531, 278); 141 this.dataGridView.ReadOnly = true; 142 this.dataGridView.RowHeadersWidth = 80; 143 this.dataGridView.Size = new System.Drawing.Size(530, 278); 136 144 this.dataGridView.TabIndex = 4; 145 this.dataGridView.VirtualMode = true; 137 146 this.dataGridView.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.dataGridView_CellValueNeeded); 138 147 // -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Views/StatisticsView.cs
r10374 r10534 53 53 } 54 54 55 columns[0].HeaderCell.Value = "Type"; 56 columns[1].HeaderCell.Value = "Missing Values"; 57 columns[2].HeaderCell.Value = "Min"; 58 columns[3].HeaderCell.Value = "Max"; 59 columns[4].HeaderCell.Value = "Median"; 60 columns[5].HeaderCell.Value = "Average"; 61 columns[6].HeaderCell.Value = "std. Deviation"; 62 columns[7].HeaderCell.Value = "Variance"; 63 columns[8].HeaderCell.Value = "Most Common Value"; 64 columns[9].HeaderCell.Value = "Num. diff. Values"; 65 55 66 for (int i = 0; i < logic.GetColumnCount(); ++i) { 56 67 List<string> list; … … 72 83 dataGridView.Columns.Clear(); 73 84 dataGridView.Columns.AddRange(columns); 74 dataGridView.RowCount = columnsRowsMatrix [0].Count;85 dataGridView.RowCount = columnsRowsMatrix.Count; 75 86 87 for (int i = 0; i < columnsRowsMatrix.Count; ++i) { 88 dataGridView.Rows[i].HeaderCell.Value = logic.GetVariableName(i); 89 } 90 dataGridView.AllowUserToResizeColumns = true; 76 91 } 77 92 … … 115 130 logic.GetMin<DateTime>(columnIndex).ToString(), 116 131 logic.GetMax<DateTime>(columnIndex).ToString(), 117 "", //median118 "", //average119 "", //standard deviation120 "", //variance121 logic.GetMostCommonValue< string>(columnIndex).ToString(),122 logic.GetDifferentValuesCount< string>(columnIndex).ToString()132 logic.GetMedianDateTime(columnIndex).ToString(), 133 logic.GetAverageDateTime(columnIndex).ToString(), 134 logic.GetStandardDeviation(columnIndex).ToString(), 135 logic.GetVariance(columnIndex).ToString(), //variance 136 logic.GetMostCommonValue<DateTime>(columnIndex).ToString(), 137 logic.GetDifferentValuesCount<DateTime>(columnIndex).ToString() 123 138 }; 124 139 } … … 129 144 130 145 private void dataGridView_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e) { 131 if (Content != null && e.RowIndex < columnsRowsMatrix.Count && e.ColumnIndex < Content.StatisticsLogic.GetColumnCount()) {132 dataGridView[e.ColumnIndex, e.RowIndex].Value = columnsRowsMatrix[e.ColumnIndex][e.RowIndex];146 if (Content != null && e.RowIndex < columnsRowsMatrix.Count && e.ColumnIndex < columnsRowsMatrix[0].Count) { 147 e.Value = columnsRowsMatrix[e.RowIndex][e.ColumnIndex]; 133 148 } 134 149 }
Note: See TracChangeset
for help on using the changeset viewer.