Changeset 2512 for trunk/sources/HeuristicLab.DataAnalysis
- Timestamp:
- 11/19/09 16:21:15 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.DataAnalysis/3.2/DatasetView.cs
r2311 r2512 57 57 Refresh(); 58 58 })); 59 } 59 } 60 60 } 61 61 … … 126 126 127 127 private void dataGridView_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e) { 128 e.Value = Dataset.GetValue(e.RowIndex, e.ColumnIndex); 128 if (this.Dataset == null) 129 e.Value = null; 130 else 131 e.Value = Dataset.GetValue(e.RowIndex, e.ColumnIndex); 129 132 } 130 133 … … 143 146 144 147 private void scaleValuesToolStripMenuItem_Click(object sender, EventArgs e) { 145 foreach (DataGridViewColumn column in dataGridView.SelectedColumns) {148 foreach (DataGridViewColumn column in dataGridView.SelectedColumns) { 146 149 Dataset.ScaleVariable(column.Index); 147 150 column.Name = GetColumnName(column.Index) + " [scaled]"; … … 151 154 152 155 private void originalValuesToolStripMenuItem_Click(object sender, EventArgs e) { 153 foreach (DataGridViewColumn column in dataGridView.SelectedColumns) {156 foreach (DataGridViewColumn column in dataGridView.SelectedColumns) { 154 157 Dataset.UnscaleVariable(column.Index); 155 158 column.Name = GetColumnName(column.Index); 156 159 } 157 Refresh(); 160 Refresh(); 158 161 } 159 162 160 163 private string GetColumnName(int index) { 161 if (Dataset.Columns == dataGridView.Columns.Count) {164 if (Dataset.Columns == dataGridView.Columns.Count) { 162 165 return Dataset.GetVariableName(index); 163 166 } else { … … 169 172 ManualScalingControl scalingControl = new ManualScalingControl(false); 170 173 double[,] scalingParameters = new double[2, Dataset.Columns]; 171 for (int i = 0; i < Dataset.Columns; i++) {174 for (int i = 0; i < Dataset.Columns; i++) { 172 175 scalingParameters[0, i] = Dataset.ScalingFactor[i]; 173 176 scalingParameters[1, i] = Dataset.ScalingOffset[i]; … … 180 183 ManualScalingControl scalingControl = new ManualScalingControl(true); 181 184 double[,] scalingParameters = new double[2, Dataset.Columns]; 182 for (int i = 0; i < Dataset.Columns; i++) {185 for (int i = 0; i < Dataset.Columns; i++) { 183 186 scalingParameters[0, i] = Dataset.ScalingFactor[i]; 184 187 scalingParameters[1, i] = Dataset.ScalingOffset[i]; 185 188 } 186 189 scalingControl.Data = scalingParameters; 187 if (scalingControl.ShowDialog() == DialogResult.OK) {188 for (int i = 0; i < Dataset.Columns; i++) {190 if (scalingControl.ShowDialog() == DialogResult.OK) { 191 for (int i = 0; i < Dataset.Columns; i++) { 189 192 Dataset.ScaleVariable(i, scalingControl.Data[0, i], scalingControl.Data[1, i]); 190 193 } … … 193 196 } 194 197 195 198 196 199 } 197 200 }
Note: See TracChangeset
for help on using the changeset viewer.