Changeset 8529
- Timestamp:
- 08/27/12 17:59:55 (12 years ago)
- Location:
- branches/DatasetFeatureCorrelation
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DatasetFeatureCorrelation/HeuristicLab.Problems.DataAnalysis.Views/3.4/FeatureCorrelationView.Designer.cs
r8492 r8529 35 35 this.PictureBox = new System.Windows.Forms.PictureBox(); 36 36 this.SplitContainer = new System.Windows.Forms.SplitContainer(); 37 this.CalculatingPanel = new System.Windows.Forms.Panel(); 38 this.CalculatingLabel = new System.Windows.Forms.Label(); 37 39 ((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit(); 38 40 ((System.ComponentModel.ISupportInitialize)(this.PictureBox)).BeginInit(); … … 41 43 this.SplitContainer.Panel2.SuspendLayout(); 42 44 this.SplitContainer.SuspendLayout(); 45 this.CalculatingPanel.SuspendLayout(); 43 46 this.SuspendLayout(); 44 47 // … … 55 58 this.DataGridView.TabIndex = 0; 56 59 this.DataGridView.VirtualMode = true; 60 this.DataGridView.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(this.DataGridView_CellPainting); 57 61 this.DataGridView.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.DataGridView_CellValueNeeded); 58 62 this.DataGridView.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.DataGridView_ColumnHeaderMouseClick); … … 61 65 // HeatMapProgressBar 62 66 // 63 this.HeatMapProgressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 64 | System.Windows.Forms.AnchorStyles.Right))); 65 this.HeatMapProgressBar.Location = new System.Drawing.Point(490, 6); 67 this.HeatMapProgressBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); 68 this.HeatMapProgressBar.Location = new System.Drawing.Point(25, 46); 66 69 this.HeatMapProgressBar.Name = "HeatMapProgressBar"; 67 70 this.HeatMapProgressBar.RightToLeft = System.Windows.Forms.RightToLeft.No; 68 this.HeatMapProgressBar.Size = new System.Drawing.Size( 76, 21);71 this.HeatMapProgressBar.Size = new System.Drawing.Size(154, 21); 69 72 this.HeatMapProgressBar.TabIndex = 9; 70 this.HeatMapProgressBar.Visible = false;71 73 // 72 74 // PartitionComboBox 73 75 // 76 this.PartitionComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 74 77 this.PartitionComboBox.FormattingEnabled = true; 75 this.PartitionComboBox.Location = new System.Drawing.Point(3 48, 3);78 this.PartitionComboBox.Location = new System.Drawing.Point(333, 3); 76 79 this.PartitionComboBox.Name = "PartitionComboBox"; 77 this.PartitionComboBox.Size = new System.Drawing.Size(1 24, 21);80 this.PartitionComboBox.Size = new System.Drawing.Size(142, 21); 78 81 this.PartitionComboBox.TabIndex = 8; 79 82 this.PartitionComboBox.SelectedIndexChanged += new System.EventHandler(this.PartitionComboBox_SelectedIndexChanged); … … 90 93 // CorrelationCalcComboBox 91 94 // 95 this.CorrelationCalcComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 92 96 this.CorrelationCalcComboBox.FormattingEnabled = true; 93 97 this.CorrelationCalcComboBox.Location = new System.Drawing.Point(110, 3); … … 121 125 this.maximumLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 122 126 this.maximumLabel.BackColor = System.Drawing.Color.Transparent; 123 this.maximumLabel.Location = new System.Drawing.Point(487, 30);127 this.maximumLabel.Location = new System.Drawing.Point(487, 2); 124 128 this.maximumLabel.Name = "maximumLabel"; 125 129 this.maximumLabel.Size = new System.Drawing.Size(73, 25); … … 134 138 this.PictureBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 135 139 this.PictureBox.Image = ((System.Drawing.Image)(resources.GetObject("PictureBox.Image"))); 136 this.PictureBox.Location = new System.Drawing.Point(507, 58);140 this.PictureBox.Location = new System.Drawing.Point(507, 30); 137 141 this.PictureBox.Name = "PictureBox"; 138 this.PictureBox.Size = new System.Drawing.Size(35, 2 53);142 this.PictureBox.Size = new System.Drawing.Size(35, 281); 139 143 this.PictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; 140 144 this.PictureBox.TabIndex = 15; … … 161 165 // SplitContainer.Panel2 162 166 // 167 this.SplitContainer.Panel2.Controls.Add(this.CalculatingPanel); 163 168 this.SplitContainer.Panel2.Controls.Add(this.DataGridView); 164 169 this.SplitContainer.Size = new System.Drawing.Size(475, 330); … … 166 171 this.SplitContainer.TabIndex = 16; 167 172 // 173 // CalculatingPanel 174 // 175 this.CalculatingPanel.Anchor = System.Windows.Forms.AnchorStyles.None; 176 this.CalculatingPanel.Controls.Add(this.CalculatingLabel); 177 this.CalculatingPanel.Controls.Add(this.HeatMapProgressBar); 178 this.CalculatingPanel.Location = new System.Drawing.Point(138, 95); 179 this.CalculatingPanel.Name = "CalculatingPanel"; 180 this.CalculatingPanel.Size = new System.Drawing.Size(200, 81); 181 this.CalculatingPanel.TabIndex = 10; 182 // 183 // CalculatingLabel 184 // 185 this.CalculatingLabel.AutoSize = true; 186 this.CalculatingLabel.Location = new System.Drawing.Point(42, 19); 187 this.CalculatingLabel.Name = "CalculatingLabel"; 188 this.CalculatingLabel.Size = new System.Drawing.Size(120, 13); 189 this.CalculatingLabel.TabIndex = 10; 190 this.CalculatingLabel.Text = "Calculating correlation..."; 191 // 168 192 // FeatureCorrelationView 169 193 // … … 172 196 this.Controls.Add(this.SplitContainer); 173 197 this.Controls.Add(this.minimumLabel); 174 this.Controls.Add(this.HeatMapProgressBar);175 198 this.Controls.Add(this.PictureBox); 176 199 this.Controls.Add(this.maximumLabel); … … 184 207 ((System.ComponentModel.ISupportInitialize)(this.SplitContainer)).EndInit(); 185 208 this.SplitContainer.ResumeLayout(false); 209 this.CalculatingPanel.ResumeLayout(false); 210 this.CalculatingPanel.PerformLayout(); 186 211 this.ResumeLayout(false); 187 212 … … 200 225 protected System.Windows.Forms.PictureBox PictureBox; 201 226 protected System.Windows.Forms.SplitContainer SplitContainer; 227 protected System.Windows.Forms.Panel CalculatingPanel; 228 protected System.Windows.Forms.Label CalculatingLabel; 202 229 203 230 } -
branches/DatasetFeatureCorrelation/HeuristicLab.Problems.DataAnalysis.Views/3.4/FeatureCorrelationView.cs
r8492 r8529 65 65 66 66 protected void Content_ProgressCalculation(object sender, ProgressChangedEventArgs e) { 67 if (! HeatMapProgressBar.Visible && e.ProgressPercentage != HeatMapProgressBar.Maximum) {68 HeatMapProgressBar.Show();67 if (!CalculatingPanel.Visible && e.ProgressPercentage != HeatMapProgressBar.Maximum) { 68 CalculatingPanel.Show(); 69 69 } else if (e.ProgressPercentage == HeatMapProgressBar.Maximum) { 70 HeatMapProgressBar.Hide();70 CalculatingPanel.Hide(); 71 71 } 72 72 HeatMapProgressBar.Value = e.ProgressPercentage; … … 76 76 base.OnContentChanged(); 77 77 if (Content != null) { 78 UpdateDataGrid();79 78 CorrelationCalcComboBox.DataSource = Content.CorrelationCalculators; 80 79 PartitionComboBox.DataSource = Content.Partitions; … … 94 93 string partition = (string)PartitionComboBox.SelectedItem; 95 94 if (calc != null && partition != null) { 95 DataGridView.Columns.Clear(); 96 96 DataGridView.Enabled = false; 97 97 Content.Recalculate(calc, partition); … … 144 144 } 145 145 146 pr ivatevoid DataGridView_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e) {146 protected void DataGridView_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e) { 147 147 if (Content != null && DataGridView.Enabled && e.RowIndex < Content.Rows && e.ColumnIndex < Content.Columns) { 148 148 int rowIndex = virtualRowIndices[e.RowIndex]; 149 149 e.Value = Content[rowIndex, e.ColumnIndex]; 150 DataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = GetDataPointColor(Content[rowIndex, e.ColumnIndex], Content.Minimum, Content.Maximum); 151 } 150 } 151 } 152 153 protected void DataGridView_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) { 154 if (Content != null && DataGridView.Enabled && e.RowIndex >= 0 && e.ColumnIndex >= 0 && e.PaintParts.HasFlag(DataGridViewPaintParts.Background)) { 155 int rowIndex = virtualRowIndices[e.RowIndex]; 156 e.CellStyle.BackColor = GetDataPointColor(Content[rowIndex, e.ColumnIndex], Content.Minimum, Content.Maximum); 157 } 158 e.Paint(e.CellBounds, e.PaintParts); 152 159 } 153 160 … … 158 165 if (index < 0) index = 0; 159 166 return colors[index]; 160 }161 162 protected override void OnShown(ViewShownEventArgs e) {163 base.OnShown(e);164 CalculateCorrelation();165 167 } 166 168 … … 204 206 UpdateSortGlyph(); 205 207 UpdateRowHeaders(); 208 DataGridView.Invalidate(); 206 209 } 207 210 -
branches/DatasetFeatureCorrelation/HeuristicLab.Problems.DataAnalysis.Views/3.4/TimeframeFeatureCorrelationView.Designer.cs
r8492 r8529 31 31 ((System.ComponentModel.ISupportInitialize)(this.SplitContainer)).BeginInit(); 32 32 this.SplitContainer.Panel1.SuspendLayout(); 33 this.SplitContainer.Panel2.SuspendLayout(); 33 34 this.SplitContainer.SuspendLayout(); 35 this.CalculatingPanel.SuspendLayout(); 34 36 this.SuspendLayout(); 37 // 38 // PartitionComboBox 39 // 40 this.PartitionComboBox.Location = new System.Drawing.Point(344, 3); 41 this.PartitionComboBox.Size = new System.Drawing.Size(131, 21); 35 42 // 36 43 // maximumLabel 37 44 // 38 this.maximumLabel.Location = new System.Drawing.Point(487, 62);45 this.maximumLabel.Location = new System.Drawing.Point(487, 3); 39 46 // 40 47 // PictureBox 41 48 // 42 this.PictureBox.Location = new System.Drawing.Point(506, 91);43 this.PictureBox.Size = new System.Drawing.Size(35, 2 20);49 this.PictureBox.Location = new System.Drawing.Point(506, 31); 50 this.PictureBox.Size = new System.Drawing.Size(35, 280); 44 51 // 45 52 // SplitContainer … … 54 61 this.SplitContainer.SplitterDistance = 52; 55 62 // 63 // CalculatingPanel 64 // 65 this.CalculatingPanel.Location = new System.Drawing.Point(138, 82); 66 // 56 67 // VariableSelectionLabel 57 68 // … … 65 76 // VariableSelectionComboBox 66 77 // 78 this.VariableSelectionComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 67 79 this.VariableSelectionComboBox.FormattingEnabled = true; 68 80 this.VariableSelectionComboBox.Location = new System.Drawing.Point(110, 30); … … 83 95 // TimeframeComboBox 84 96 // 97 this.TimeframeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 85 98 this.TimeframeComboBox.FormattingEnabled = true; 86 this.TimeframeComboBox.Location = new System.Drawing.Point(34 8, 30);99 this.TimeframeComboBox.Location = new System.Drawing.Point(344, 30); 87 100 this.TimeframeComboBox.Name = "TimeframeComboBox"; 88 this.TimeframeComboBox.Size = new System.Drawing.Size(1 24, 21);101 this.TimeframeComboBox.Size = new System.Drawing.Size(131, 21); 89 102 this.TimeframeComboBox.TabIndex = 19; 90 103 this.TimeframeComboBox.SelectedIndexChanged += new System.EventHandler(this.TimeframeComboBox_SelectedIndexChanged); … … 98 111 this.SplitContainer.Panel1.ResumeLayout(false); 99 112 this.SplitContainer.Panel1.PerformLayout(); 113 this.SplitContainer.Panel2.ResumeLayout(false); 100 114 ((System.ComponentModel.ISupportInitialize)(this.SplitContainer)).EndInit(); 101 115 this.SplitContainer.ResumeLayout(false); 116 this.CalculatingPanel.ResumeLayout(false); 117 this.CalculatingPanel.PerformLayout(); 102 118 this.ResumeLayout(false); 103 119 -
branches/DatasetFeatureCorrelation/HeuristicLab.Problems.DataAnalysis.Views/3.4/TimeframeFeatureCorrelationView.cs
r8492 r8529 59 59 string variable = (string)VariableSelectionComboBox.SelectedItem; 60 60 if (calc != null && partition != null && variable != null) { 61 DataGridView.Columns.Clear(); 61 62 DataGridView.Enabled = false; 62 63 int frames = (int)TimeframeComboBox.SelectedItem; -
branches/DatasetFeatureCorrelation/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisProblemData.cs
r8483 r8529 37 37 protected const string TrainingPartitionParameterName = "TrainingPartition"; 38 38 protected const string TestPartitionParameterName = "TestPartition"; 39 protected const string Dataset HeatMapParameterName = "DatasetCorrelationHeatMap";39 protected const string DatasetCorrelationParameterName = "Dataset Correlation"; 40 40 41 41 #region parameter properites … … 52 52 get { return (IFixedValueParameter<IntRange>)Parameters[TestPartitionParameterName]; } 53 53 } 54 public IFixedValueParameter<FeatureCorrelation> Dataset HeatMapParameter {55 get { return (IFixedValueParameter<FeatureCorrelation>)Parameters[Dataset HeatMapParameterName]; }54 public IFixedValueParameter<FeatureCorrelation> DatasetCorrelationParameter { 55 get { return (IFixedValueParameter<FeatureCorrelation>)Parameters[DatasetCorrelationParameterName]; } 56 56 } 57 57 #endregion … … 78 78 get { return TestPartitionParameter.Value; } 79 79 } 80 public FeatureCorrelation Dataset HeatMap{81 get { return Dataset HeatMapParameter.Value; }80 public FeatureCorrelation DatasetCorrelation { 81 get { return DatasetCorrelationParameter.Value; } 82 82 } 83 83 … … 119 119 // BackwardsCompatibility3.3 120 120 #region Backwards compatible code, remove with 3.4 121 if (!Parameters.ContainsKey(Dataset HeatMapParameterName)) {122 Parameters.Add(new FixedValueParameter<FeatureCorrelation>(Dataset HeatMapParameterName, "", new FeatureCorrelation()));121 if (!Parameters.ContainsKey(DatasetCorrelationParameterName)) { 122 Parameters.Add(new FixedValueParameter<FeatureCorrelation>(DatasetCorrelationParameterName, "", new FeatureCorrelation())); 123 123 } 124 124 #endregion 125 Dataset HeatMap.ProblemData = this;125 DatasetCorrelation.ProblemData = this; 126 126 RegisterEventHandlers(); 127 127 } … … 147 147 Parameters.Add(new FixedValueParameter<IntRange>(TrainingPartitionParameterName, "", new IntRange(trainingPartitionStart, trainingPartitionEnd))); 148 148 Parameters.Add(new FixedValueParameter<IntRange>(TestPartitionParameterName, "", new IntRange(testPartitionStart, testPartitionEnd))); 149 Parameters.Add(new FixedValueParameter<FeatureCorrelation>(Dataset HeatMapParameterName, "", new FeatureCorrelation(this)));149 Parameters.Add(new FixedValueParameter<FeatureCorrelation>(DatasetCorrelationParameterName, "", new FeatureCorrelation(this))); 150 150 151 151 ((ValueParameter<Dataset>)DatasetParameter).ReactOnValueToStringChangedAndValueItemImageChanged = false; -
branches/DatasetFeatureCorrelation/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/FeatureCorrelation.cs
r8492 r8529 65 65 66 66 private BackgroundWorker bw; 67 private BackgroundWorkerInfo bwInfo; 67 68 68 69 public FeatureCorrelation() … … 80 81 this.rowNames = problemData.Dataset.DoubleVariables.ToList(); 81 82 sortableView = true; 82 83 CalculateElements(problemData.Dataset);84 83 } 85 84 protected FeatureCorrelation(FeatureCorrelation original, Cloner cloner) … … 107 106 108 107 private void CalculateElements(Dataset dataset, string calc, string partition, string variable = null, int frames = 0) { 109 if (bw == null || bw.IsBusy) { 110 if (bw != null) { 111 bw.CancelAsync(); 112 } 108 bwInfo = new BackgroundWorkerInfo { Dataset = dataset, Calculator = calc, Partition = partition, Variable = variable, Frames = frames }; 109 if (bw == null) { 113 110 bw = new BackgroundWorker(); 114 111 bw.WorkerReportsProgress = true; … … 118 115 bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BwRunWorkerCompleted); 119 116 } 120 bw.RunWorkerAsync(new BackgroundWorkerInfo { Dataset = dataset, Calculator = calc, Partition = partition, Variable = variable, Frames = frames }); 117 if (bw.IsBusy) { 118 bw.CancelAsync(); 119 } else { 120 bw.RunWorkerAsync(bwInfo); 121 } 121 122 if (calc.Equals(PearsonsR) || calc.Equals(SpearmansRank)) { 122 123 Maximum = 1.0; … … 256 257 OnCorrelationCalculationFinished(); 257 258 } 259 } else { 260 bw.RunWorkerAsync(bwInfo); 258 261 } 259 262 }
Note: See TracChangeset
for help on using the changeset viewer.