- Timestamp:
- 09/24/12 18:48:16 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/FeatureCorrelation
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/FeatureCorrelation/AbstractFeatureCorrelationView.Designer.cs
r8578 r8689 46 46 /// </summary> 47 47 private void InitializeComponent() { 48 this.components = new System.ComponentModel.Container(); 48 49 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AbstractFeatureCorrelationView)); 49 50 this.DataGridView = new System.Windows.Forms.DataGridView(); … … 59 60 this.CalculatingPanel = new System.Windows.Forms.Panel(); 60 61 this.CalculatingLabel = new System.Windows.Forms.Label(); 62 this.contextMenu = new System.Windows.Forms.ContextMenuStrip(this.components); 63 this.ShowHideColumns = new System.Windows.Forms.ToolStripMenuItem(); 61 64 ((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit(); 62 65 ((System.ComponentModel.ISupportInitialize)(this.PictureBox)).BeginInit(); … … 66 69 this.SplitContainer.SuspendLayout(); 67 70 this.CalculatingPanel.SuspendLayout(); 71 this.contextMenu.SuspendLayout(); 68 72 this.SuspendLayout(); 69 73 // … … 84 88 this.DataGridView.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.DataGridView_ColumnHeaderMouseClick); 85 89 this.DataGridView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.DataGridView_KeyDown); 90 this.DataGridView.MouseClick += new System.Windows.Forms.MouseEventHandler(this.DataGridView_MouseClick); 86 91 // 87 92 // HeatMapProgressBar … … 211 216 this.CalculatingLabel.TabIndex = 10; 212 217 this.CalculatingLabel.Text = "Calculating correlation..."; 218 // 219 // contextMenu 220 // 221 this.contextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 222 this.ShowHideColumns}); 223 this.contextMenu.Name = "contextMenu"; 224 this.contextMenu.Size = new System.Drawing.Size(191, 26); 225 // 226 // ShowHideColumns 227 // 228 this.ShowHideColumns.Name = "ShowHideColumns"; 229 this.ShowHideColumns.Size = new System.Drawing.Size(190, 22); 230 this.ShowHideColumns.Text = "Show / Hide Columns"; 231 this.ShowHideColumns.Click += new System.EventHandler(this.ShowHideColumns_Click); 213 232 // 214 233 // AbstractFeatureCorrelationView … … 231 250 this.CalculatingPanel.ResumeLayout(false); 232 251 this.CalculatingPanel.PerformLayout(); 252 this.contextMenu.ResumeLayout(false); 233 253 this.ResumeLayout(false); 234 254 … … 249 269 protected System.Windows.Forms.Panel CalculatingPanel; 250 270 protected System.Windows.Forms.Label CalculatingLabel; 271 protected System.Windows.Forms.ContextMenuStrip contextMenu; 272 protected System.Windows.Forms.ToolStripMenuItem ShowHideColumns; 251 273 252 274 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/FeatureCorrelation/AbstractFeatureCorrelationView.cs
r8578 r8689 30 30 using HeuristicLab.Common; 31 31 using HeuristicLab.Data.Views; 32 using HeuristicLab.DataAnalysis.Views; 32 33 using HeuristicLab.MainForm; 33 34 using HeuristicLab.MainForm.WindowsForms; … … 40 41 41 42 private int[] virtualRowIndices; 43 private VariableVisibilityDialog variableVisibility; 42 44 private List<KeyValuePair<int, SortOrder>> sortedColumnIndices; 43 45 private StringConvertibleMatrixView.RowComparer rowComparer; … … 82 84 if (Content != null) { 83 85 fcc.ProblemData = Content; 86 bool[] initialVisibility = SetInitialVisibilityOfColumns(); 87 88 variableVisibility = new VariableVisibilityDialog(Content.Dataset.DoubleVariables, initialVisibility); 89 variableVisibility.VariableVisibilityChanged += new ItemCheckEventHandler(variableVisibility_VariableVisibilityChanged); 84 90 CalculateCorrelation(); 85 91 } else { … … 88 94 } 89 95 } 96 97 protected virtual bool[] SetInitialVisibilityOfColumns() { 98 bool[] initialVisibility = new bool[Content.Dataset.DoubleVariables.Count()]; 99 int i = 0; 100 foreach (var variable in Content.Dataset.DoubleVariables) { 101 initialVisibility[i] = Content.AllowedInputVariables.Contains(variable); 102 i++; 103 } 104 return initialVisibility; 105 } 106 107 protected abstract void variableVisibility_VariableVisibilityChanged(object sender, ItemCheckEventArgs e); 90 108 91 109 protected void CorrelationMeasureComboBox_SelectedChangeCommitted(object sender, System.EventArgs e) { … … 127 145 for (int i = 0; i < DataGridView.ColumnCount; i++) { 128 146 DataGridView.Columns[i].HeaderText = currentCorrelation.ColumnNames.ElementAt(i); 147 DataGridView.Columns[i].Visible = variableVisibility.Visibility[i]; 129 148 } 130 149 } … … 132 151 for (int i = 0; i < DataGridView.RowCount; i++) { 133 152 DataGridView.Rows[i].HeaderCell.Value = currentCorrelation.RowNames.ElementAt(virtualRowIndices[i]); 153 DataGridView.Rows[i].Visible = variableVisibility.Visibility[virtualRowIndices[i]]; 134 154 } 135 155 } … … 169 189 170 190 protected virtual Color GetDataPointColor(double value, double min, double max) { 191 if (double.IsNaN(value)) { 192 return Color.DarkGray; 193 } 171 194 IList<Color> colors = ColorGradient.Colors; 172 195 int index = (int)((colors.Count - 1) * (value - min) / (max - min)); … … 301 324 } 302 325 #endregion 326 327 protected void ShowHideColumns_Click(object sender, EventArgs e) { 328 variableVisibility.ShowDialog(); 329 } 330 331 protected void DataGridView_MouseClick(object sender, MouseEventArgs e) { 332 if (Content == null) return; 333 if (e.Button == MouseButtons.Right && DataGridView.Columns.Count != 0) 334 contextMenu.Show(MousePosition); 335 } 336 337 protected int GetRowIndexOfVirtualindex(int virtualIndex) { 338 if (virtualIndex < 0 || virtualIndex >= virtualRowIndices.Length) { 339 throw new ArgumentException("Virtual index is out of bounds"); 340 } 341 342 for (int i = 0; i < virtualRowIndices.Length; i++) { 343 if (virtualRowIndices[i] == virtualIndex) { 344 return i; 345 } 346 } 347 throw new ArgumentException("Virtual index was not found!"); 348 } 303 349 } 304 350 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/FeatureCorrelation/AbstractFeatureCorrelationView.resx
r8578 r8689 1020 1020 </value> 1021 1021 </data> 1022 <metadata name="contextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 1023 <value>17, 17</value> 1024 </metadata> 1022 1025 </root> -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/FeatureCorrelation/FeatureCorrelationView.cs
r8578 r8689 78 78 } 79 79 } 80 81 protected override void variableVisibility_VariableVisibilityChanged(object sender, ItemCheckEventArgs e) { 82 DataGridView.Columns[e.Index].Visible = e.NewValue == CheckState.Checked; 83 DataGridView.Rows[GetRowIndexOfVirtualindex(e.Index)].Visible = e.NewValue == CheckState.Checked; 84 } 80 85 } 81 86 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/FeatureCorrelation/TimeframeFeatureCorrelationView.cs
r8578 r8689 107 107 } 108 108 } 109 110 protected override void variableVisibility_VariableVisibilityChanged(object sender, ItemCheckEventArgs e) { 111 DataGridView.Rows[GetRowIndexOfVirtualindex(e.Index)].Visible = e.NewValue == CheckState.Checked; 112 } 109 113 } 110 114 }
Note: See TracChangeset
for help on using the changeset viewer.